drqj8605 2014-03-12 04:16
浏览 53

PHP表单处理器脚本不重定向

i am making an html contact form with PHP processor script. Here is my code

HTML

    <form enctype="multipart/form-data" action="contactprocessor.php" method="post" class="wpcf7-form" onSubmit="return validatePage1();">
      <div class="form-row">
        <label class="label">Name*</label>
        <span class="wpcf7-form-control-wrap name">
        <input type="text" id=field_1 name=field_1 value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required text-input" aria-required="true" placeholder="Introduce yourself" />
        </span></div>
      <div class="form-row">
        <label class="label">Company</label>
        <span class="wpcf7-form-control-wrap company">
        <input type="text" name=field_2 id=field_2 value="" size="40" class="wpcf7-form-control wpcf7-text text-input" placeholder="Fly your company flag" />
        </span></div>
      <div class="form-row">
        <label class="label">Email* </label>
        <span class="wpcf7-form-control-wrap email">
        <input type="email" name=field_3 id=field_3 value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email text-input" aria-required="true" placeholder="Help us keep in touch" />
        </span></div>
      <div class="form-row">
        <label class="label">Phone</label>
        <span class="wpcf7-form-control-wrap phone">
        <input type="tel" name=field_4 id=field_4 value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-tel wpcf7-validates-as-tel text-input" placeholder="If you fancy a chat" />
        </span></div>
      <div class="form-row">
        <label class="label">Subject*</label>
        <span class="wpcf7-form-control-wrap subject">
        <input type="text" name=field_5 id=field_5 value="" size="40" class="wpcf7-form-control wpcf7-text text-input" placeholder="What’s on your mind?" />
        </span></div>
      <div class="form-row">
        <label class="label">Message*</label>
        <span class="wpcf7-form-control-wrap message">
        <textarea name=field_6 id=field_6 cols="40" rows="14" class="wpcf7-form-control wpcf7-textarea wpcf7-validates-as-required" aria-required="true" placeholder="Share your thoughts and comments"></textarea>
        </span></div>
      <div class="form-row">
        <input id="saveForm" type="submit" value="Get In Touch" class="wpcf7-form-control wpcf7-submit btn--invert" />
      </div>

    </form>

Here is the contactprocessor.php code

<?php

  mail("jen@abhayayks.com",$_POST['field_5'],

  "Form data:

   Name: " . $_POST['field_1'] . "
   
Email: " . $_POST['field_3'] . " 
   
Phone : " . $_POST['field_4'] . " 
   
Company : " . $_POST['field_2'] . "  
   
Message : " . $_POST['field_6'] . " 

    ");

    header("Location: contact.php");

   ?>

Now when i submit the form, i am receiving the mail confirming that PHP script is working. But i not getting redirected back to contact.php (i have tried using index.php also and even http://www.google.com). Can you please point out the mistake?

Edit: Now, i have switched on error log and error reporting from php.ini file, have restarted my local server, ran the script, got the mail, again not redirecting, no error in error log file. I have uploaded the files on my online server. You can confirm the issue. Link

Edit 2 I just have noticed that nothing is working except the mail function. I mean have tried using

echo '<script type="text/javascript">window.onload = function(){ alert("Thank you");}</script>';

and this is also not working. I have also tried including some other file using include("confirm.html"); and that file is not getting included.

  • 写回答

3条回答 默认 最新

  • doumeng3188 2014-03-12 04:21
    关注

    header("Location:contact.php"); should be header("Location: contact.php");

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么