[英]I want to redirect to specified HTML page
I have a index page inside of it a form.我有一个索引页,里面有一个表单。 I put in it phone number and email and quantity and it sends a request to my email.我输入了电话号码、电子邮件和数量,然后它会向我的电子邮件发送请求。 The problem I'm facing is after I click proceed, it stays on same page, and nothing changes.我面临的问题是在我点击继续后,它停留在同一页面上,没有任何变化。 I want when I click procced to redirect me to specified HTML file.我希望当我单击 procced 时将我重定向到指定的 HTML 文件。
The HTML part is: HTML 部分是:
<div style="opacity: 0.9;" class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content" style="background: #002b49;">
<div class="modal-header" style="border: none;">
<h5 class="modal-title" id="exampleModalLabel"> </h5>
<button type="button" style="background: none; border: none; color: #fff;" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="defaultForm-group">
<div class="field calculator-price " data-target="field" data-component="calculator-price-field" data-field="price">
<div class="field-input">
<div class="field-prefix">
<div class="field-prefix-wrapper">
<span class="field-prefix-label" data-component="field-prefix" data-related-name="price-prefix"><img height="14px" src="img/incoming-call.png"></span>
</div>
</div>
<input type="number" class="defaultInput" id="tnumber" placeholder="Telephone no" name="price" step="10" min="0" required="" autocomplete="off">
</div>
</div>
<div class="field calculator-currency" data-target="field" data-field="currency">
<div class="field-input">
<div class="field-prefix">
<span class=""><img height="14px" src="img/email.png"></span>
</div>
<div class="defaultSelec defaultSelect--form ">
<input class="defaultSelect-select" name="currency" id="emailaddress" placeholder="Email Address"></div>
</div>
</div>
</div>
</div>
<p class="error_rep2" style="color: #fff;"></p>
<p class="submitinfo2" style="color: #fff;"></p>
<div class="modal-footer">
<button type="button" id="mproceed" class="btn btn--secondary btn--large">Proceed</button>
</div>
</div>
</div>
</div>
The PHP part: PHP部分:
if(isset($email)){
$send = SimpleMail::make()
->setTo('chacha@gmail.com', 'Elie Services')
->setFrom($email, $fname)
->setSubject($fname,$lname)
->setMessage($msgbody)
// ->setReplyTo($replyEmail, $replyName)
->setHtml()
->setWrap(100)
->send();
if ($send) {
// echo 'Your Message Sent Successfully!';
header("location: success.html");
} else {
echo 'An error occurred. We could not send email';
$page = "success.html";
$sec = "3";
header("Refresh: $sec; url=$page");
}
}else {
$page = "success.html";
$sec = "1";
header("Refresh: $sec; url=$page");
}
?>
Please, when I press proceed I want to get redirected fully to success.html.拜托,当我按继续时,我想完全重定向到success.html。
As one of the above replies mentions, you don't have a <form>
tag anywhere.正如上述回复之一所提到的,您在任何地方都没有<form>
标签。 The Proceed button is just a regular button, and won't do anything (as you have observed). Proceed 按钮只是一个普通按钮,不会执行任何操作(如您所见)。 To get this to do what you want, first you will need something like this at the top:要让它做你想做的事,首先你需要在顶部这样的东西:
<form action='process.php' method='POST'>
(Replace process.php with the name of your PHP file.) At the bottom of your HTML, put a </form>
closing tag. (用您的 PHP 文件的名称替换 process.php。)在 HTML 的底部,放置一个</form>
结束标记。 In the <button>
tag for Proceed, change the type
to submit.在 Proceed 的<button>
标记中,更改要提交的type
。 That will cause the PHP to be called.这将导致调用 PHP。 In the PHP, you will need to use $_POST
to retrieve the INPUT field values from the form.在 PHP 中,您需要使用$_POST
从表单中检索 INPUT 字段值。 Nothing will automatically populate values in the PHP variables.没有任何东西会自动填充 PHP 变量中的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.