简体   繁体   English

我想重定向到指定的 HTML 页面

[英]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">&times;</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.

相关问题 html按钮重定向到中指定的页面<input> - html button redirect to page specified in <input> 我希望我的 html 页面在我提交某个输入时重定向到另一个 html 页面我该怎么做 - I want my html page to redirect to another html page when I submit a certain input how can i do that 在 chrome 中创建新选项卡时,我想重定向到自定义 html 页面 - I want to redirect to a custom html page when new tab is created in chrome 我想重定向到一个新页面对条件做出反应 - I want to redirect to a new page on react on a conditon 使用JavaScript重定向到指定页面 - Redirect to a specified page using JavaScript 无法将我的表单重定向到新的 html 页面。 它会转到 localhost:3000/confirm.html 而我希望它在新窗口中打开 confirm.html - Unable to redirect my form to a new html page. Its going to localhost:3000/confirm.html instead i want it to open confirm.html in a new window 我想让一个 html 按钮将我重定向到 Flask 中的另一个端点 - I want to have an html button redirect me to another endpoint in flask 如果javascript中的条件为真,我想重定向到另一个页面 - I want to redirect to another page if a condition in javascript is true 我想在单击按钮时重定向到同一目录的下一页 - - I want to redirect on next page on same directory on button click - 我希望页面在用户单击所有链接后重定向 - I want the page to redirect after the user clicks all the links
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM