18910140161

JavaScript-我想重定向到指定的HTML页面堆栈溢出

顺晟科技

2022-10-19 12:55:26

56

我有一个索引页,里面是一个表单。我把它的电话号码,电子邮件和数量,它发送一个请求到我的电子邮件。我面临的问题 在我单击继续之后,它将保持在相同的页面上,没有任何变化。 我想在单击proced时将我重定向到指定的HTML文件。

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>

PHP部分:

  <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>

请,当我按继续时,我希望完全重定向到success.html.


顺晟科技:

正如上面的一个回复所提到的,您没有任何地方的标记。Proceed按钮只是一个常规按钮,不会执行任何操作(正如您所观察到的)。要让它完成您想要的操作,首先您需要在顶部显示如下内容:

  <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>

(用PHP文件的名称替换process.PHP。)在HTML的底部,放置一个结束标记。在Proceed的标记中,将其更改为submit。这将导致调用PHP。在PHP中,您需要使用它从表单中检索输入字段值。没有任何东西会自动填充PHP变量中的值。

  • TAG:
相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航