dongrong5189 2014-02-12 17:07
浏览 56
已采纳

PHP表单未在FireFox 26.0中正确提交

I have a form on my page and when it is submit it gets sent to a php page to email me the for m inputs. The form works correctly on Chrome Version 32.0.1700.107 m and IE10, but on Firefox 26.0 it displays the following on the PHP page after the user sends the form:

Thank you, $fname! we will get back to you.

"; print"

Today's date is $date.
"; $to = "myemail@email.com"; $subject = "Financing for $fname $lname"; $body = " Date: $date 

 Note: If any fields have been left blank it means the user did not input anything. 

 First name: $fname 
 Last name: $lname 
 Company: $cname 
 Email: $email 
 Phone: $phone 
 Fax: $fax 
 Address: $address 
 City: $city 
 Province: $province 
 Postal Code: $postal 
 Equipment Type: $et 
 Amount: $amount

"; $headers = "From: info@gbmtrailer.ca"; mail($to, $subject, $body, $headers); ?>

Here is the PHP that is displayed on a Chrome web page:

Thank you, ! we will get back to you.

Today's date is Feb 12 2014.

Here is my PHP code for the PHP page:

 <?php 

$fname= $_POST['fname'];
$lname= $_POST['lname'];
$cname= $_POST['cname'];
$email= $_POST['email'];
$phone= $_POST['phone'];
$fax= $_POST['fax'];
$address= $_POST['address'];
$city= $_POST['city'];
$province= $_POST['province'];
$postal= $_POST['postal'];
$et= $_POST['et'];
$amount= $_POST['amount'];

$date = gmdate("M d Y");

print"<p>Thank you, $fname! we will get back to you.</p>";
print"<p>Today's date is $date.</p>";

$to = "------";
$subject = "Financing for $fname $lname";
$body = " Date: $date 

 Note: If any fields have been left blank it means the user did not input anything. 

 First name: $fname 
 Last name: $lname 
 Company: $cname 
 Email: $email 
 Phone: $phone 
 Fax: $fax 
 Address: $address 
 City: $city 
 Province: $province 
 Postal Code: $postal 
 Equipment Type: $et 
 Amount: $amount

";
$headers = "From: info@gbmtrailer.ca";
mail($to, $subject, $body, $headers);
?>

Here is the form code on the index.html page:

<?php date_default_timezone_set('America/Edmonton'); ?>
<!doctype html>
<!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->
<!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->
<!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="">
<!--<![endif]-->
<head>
<meta name="author" content="Kelsey Nealon(Kelseynealon@gmail.com), Contract Web Developer" />
<meta name="description" content="GBM Trailer Service Ltd. Calgary-based, proudly serving the tanker and bulk goods transportation industry for over 25 years." />
<meta name="keywords" content="Tanker, Barrel, Parts, Betts, Camloc, Scully, Lubecore, Dixon, GBM, Flotech" />
<title>GBM Trailer Service Ltd. ::: Financing</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/mobilemenu.css"/>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="boilerplate.css" rel="stylesheet" type="text/css">
<link href="responsive.css" rel="stylesheet" type="text/css">
<link href="jquery.custom-scrollbar.css" rel="stylesheet" type="text/css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="jquery.custom-scrollbar.js"></script>
<!-- 
To learn more about the conditional comments around the html tags at the top of the file:
paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/

Do the following if you're using your customized build of modernizr (http://www.modernizr.com/):
* insert the link to your js here
* remove the link below to the html5shiv
* add the "no-js" class to the html tags at the top
* you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build 
-->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- jQuery library (served from Google) -->

<script>
        $(document).ready(function(){
            $(".nav-button").click(function () {
            $(".nav-button,.primary-nav").toggleClass("open");
            });    
        });
    </script>

<script src="respond.min.js"></script>

<script type="text/javascript">
function validateForm()
{
var x=document.forms["myForm"]["fname"].value;
if (x==null || x=="")
  {
  alert("First name must be filled out");
  return false;
  }

var x=document.forms["myForm"]["lname"].value;
if (x==null || x=="")
  {
  alert("Last name must be filled out");
  return false;
  }

var x=document.forms["myForm"]["phone"].value;
if (x==null || x=="")
  {
  alert("Phone number must be filled out");
  return false;
  }

var x=document.forms["myForm"]["city"].value;
if (x==null || x=="")
  {
  alert("City/Town must be filled out");
  return false;
  }

var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;    
 if(document.forms["myForm"]["email"].value.match(mailformat))
{   
}  
else  
{  
alert("You have entered an invalid email address");  
document.myForm.email.focus(); 
return false;  
}  

  var phoneno = /^\d{10}$/;  
  if(document.forms["myForm"]["phone"].value.match(phoneno))  
  {   
  }  
  else  
  {  
     alert("Not a valid Phone Number");  
     return false;  
  }  

}

function ValidateEmail(inputText)   
{  
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;    
 if(inputText.value.match(mailformat))
{  
document.myForm.email.focus();  
}  
else  
{  
alert("You have entered an invalid email address");  
document.myForm.email.focus(); 
return false;  
}  
}  
</script>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-45342007-3', 'gbmtrailer.ca');
  ga('send', 'pageview');

</script>
</head>
<body bgcolor="#102540">
<div class="gridContainer clearfix">
  <div id="div1" class="fluid">

<div id="wrapper2"><a href="../index.html"><img src="images/bannerpics.jpg" alt="G.B.M. Trailer Service LTD. Logo" title="G.B.M. Trailer Service LTD. Logo" id="logo"/></a></div>
  <div id="wrapper3"><button class="nav-button">Toggle Navigation</button></div>

<div id="navcontain">
            <ul class="primary-nav">
                <li><a href="../index.html">Home</a>
                </li>
                <li><a href="../completions/index.html">Completions</a>
                </li>
                <li><a href="../insuranceclaims/index.html">Insurance Claims</a>
                </li>
                <li><a href="../sales/index.html">Sales</a>
                </li>
                <li><a href="../service/index.html">Service</a>
                </li>
                <li><a href="../truckmounts/index.html">Truck Mounts</a>
                </li>
                <li><a href="../certificationsandinspections/index.html">Certifications & Inspections</a>
                </li>
                <li><a href="../contactus/index.html">Contact Us</a>
                </li>
                <li><a href="../parts/index.html">Parts</a>
                </li>
                 <li><a href="../repairsandmaintenance/index.html">Repairs & Maintenance</a>
                </li>
                 <li><a href="../warranty/index.html">Warranty</a>
                </li>
                 <li><a href="../careers/index.html">Careers</a>
                </li>
                 <li><a href="#">Parts Catalogue</a>
                </li>
                 <li><a href="../modifications/index.html">Modifications</a>
                </li>
                 <li><a href="../steambays/index.html">Steam Bays</a>
                </li>
                 <li><a href="../financing/index.html">Financing</a>
                </li>
            </ul>
            </div>

  <div id="wrapper">
  <img src="images/desktopgreybackground2.jpg" id="background4">
  <img src="images/desktopgreybackground.jpg" id="background3">
  <img id="background2" src="images/background6.jpg"/>
  <div id="cover"></div>

  <div id="mainnavdesktop">
      <a href="../index.html"><img id="logo2" src="images/gbmlogo.jpg" alt="G.B.M. Trailer Service LTD. Logo" title="G.B.M. Trailer Service LTD. Logo"/></a>
        <a href="../sales/index.html"><img src="images/sales.jpg" alt="sales" title="Sales" id="sales"></a><a href="../completions/index.html"><img src="images/completions.jpg" alt="completions" title="Completions" id="completions"/></a><a href="../insuranceclaims/index.html"><img src="images/insuranceclaims.jpg" alt="insurance claims" title="Insurance Claims" id="insuranceclaims"/></a><a href="../index.html"><img src="images/home.jpg" alt="home" title="Home" id="home"/></a>
        <a href="../service/index.html"><img src="images/service.jpg" alt="service" title="Service" id="service"/></a><a href="../truckmounts/index.html"><img src="images/truckmounts.jpg" alt="truck mounts" title="Truck Mounts" id="truckmounts"/></a><a href="../certificationsandinspections/index.html"><img src="images/certificationsandinspections.jpg" alt="certifications and inspections" title="Certifications and Inspections" id="certificationsandinspections"/></a><a href="../contactus/index.html"><img src="images/contactus.jpg" alt="contact us" title="Contact Us" id="contactus"/></a>
        <a href="../parts/index.html"><img src="images/parts.jpg" alt="parts" title="Parts" id="parts"/></a><a href="../repairsandmaintenance/index.html"><img src="images/repairsandmaintenance.jpg" alt="repairs and maintenance" title="Repairs and Maintenance" id="repairsandmaintenance"/></a><a href="../warranty/index.html"><img src="images/warranty.jpg" alt="warranty" title="Warranty" id="warranty"/></a><a href="../careers/index.html"><img src="images/careers.jpg" alt="careers" title="Careers" id="careers"/></a>
        <img src="images/partscatalogue.jpg" alt="parts catalogue" title="Parts Catalogue" id="partscatalogue"/><a href="../modifications/index.html"><img src="images/modifications.jpg" alt="modifications" title="Modifications" id="modifications"/></a><a href="../steambays/index.html"><img src="images/steambays.jpg" alt="steam bays" title="Steam Bays" id="steambays"/></a><a href="../financing/index.html"><img src="images/financing.jpg" alt="financing" title="Financing" id="financing"/></a>
  </div>

<img src="images/gbmtrailerservice_trailer.png" alt="G.B.M. Trailer Service LTD. Trailer Graphic" id="trailer23">

<div id="description">
  <h1><strong>G.B.M. FINANCIAL</strong></h1>
  <p class="box1" style="text-align:left;">Offering a full variety of financial services for all heavy equipment purchases whether you found it at G.B.M. or somewhere else. We will guide you through the application and approval process.</p><p class="box2">Offering a full variety of financial services for all heavy equipment purchases whether you found it at G.B.M. or somewhere else. We will guide you through the application and approval process.</p><img src="images/heidisawatzkygbm.png" alt="Heidi Sawatzky" title="Controller" id="heidi"><img src="images/robdewargbm.png" alt="Rob Dewar" title="General Manager" id="rob"><p id="heidiemail" style="text-align:center;">Heidi Sawatzky<br /><a href="mailto:hsawatzky@gbmtrailer.ca?subject=Web%20Finance%20Information">hsawatzky@gbmtrailer.ca</a></p><p id="robemail" style="text-align:center">Rob Dewar<br /><a href="mailto:rob.dewar@gbmtrailer.ca?subject=Web%20Finance%20Information">rob.dewar@gbmtrailer.ca</a>
  <br />
  <p>&nbsp;</p>
  <p class="box3" style="text-align:left;">Heidi or Rob will help you secure your purchase. They will ensure that you are looked after and that you are suited with the right financial package. Contact them by phone 403 279 9717 or by email with any questions you may have.</p>
</div>

<div id="contenttext">
<form name="myForm" action="financing.php" onsubmit="return validateForm();" method="post"><H2 style="text-align:center;" id="conhead">Contact Information</h2><br /><br />
<p>  
First name * <input class="inputfield" type="text" name="fname"><br /><br />
Last name * <input class="inputfield" type="text" name="lname"><br /><br />
Company <input class="inputfield" type="text" name="cname"><br /><br />
Email * <input class="inputfield" type="text" name="email"><br /><br />
Phone * <input class="inputfield" type="text" name="phone"><br /><br />
Fax <input class="inputfield" type="text" name="fax"><br /><br />
Address <input class="inputfield" type="text" name="address"><br /><br />
City / Town * <input class="inputfield" type="text" name="city"><br /><br />
Province <input class="inputfield" type="text" name="province"><br /><br />
Postal Code <input class="inputfield" type="text" name="postal"><br /><br />
Equipment Type <input class="inputfield" type="text" name="et"><br /><br />
Amount <input class="inputfield" type="text" name="amount"><br /><br />
<input type="submit" value="Send" id="submitbutton"></p></form>
<p class="ppolicy"><strong>Privacy Policy:</strong> All information gathered in this form will be kept strictly confidential.</p><p class="required">
*Required</p><p id="tools">TOOLS: <a style="color:white;" href="loancalculator.html">LOAN CALCULATOR</a>, <a style="color:white;" href="creditapplication.docx" title="Basic credit application word document" target="_blank">CREDIT APPLICATION</a></p><p id="tools1"><br />TOOLS: <br /><br /><br /><br /><br /><a style="color:white;" href="loancalculator.html" title="Loan Calculator">LOAN CALCULATOR</a><br /><br /><br /><br /><br /> <a style="color:white;" href="creditapplication.docx" title="Basic credit application word document" target="_blank">CREDIT APPLICATION</a></p>
</div>
<div id="bottomquote">
  Your Certified Tanker Trailer Specialist
</div>
<div id="bottomcontactinfo">
  <em>Phone <a style="color:white; text-decoration:none;" href="tel:1-4032799717">403 279 9717</a> or <a style="color:white; text-decoration:none;" href="tel:1-888-426-9717">1 888 426 9717</a> 9300 Endeavor Dr. SE, Calgary Alberta, T3S 0A1<br /><a style="color:white; text-decoration:none;" href="mailto:info@gbmtrailer.ca">info@gbmtrailer.ca</a>
</div>

<img src="images/visamastercardlogos.gif" id="visamastercardlogos" alt="Visa and Mastercard Logo" title="Visa and Mastercard Logo">

<a href="#"><img id="mycart" src="images/mycart.gif" alt="My Cart" title="My Cart"></a>
</div>
</div>
</div>
</div>
<script>
var myWindow;

function openWin()
{
myWindow = window.open("","", "width=300,height=500");
}
</script>
<script>
<!--
var autoSizeText;
autoSizeText = function() {
  var el, elements, _i, _len, _results;
  elements = $('.resize');
  console.log(elements);
  if (elements.length < 0) {
    return;
  }
  _results = [];
  for (_i = 0, _len = elements.length; _i < _len; _i++) {
    el = elements[_i];
    _results.push((function(el) {
      var resizeText, _results1;
      resizeText = function() {
        var elNewFontSize;
        elNewFontSize = (parseInt($(el).css('font-size').slice(0, -2)) - 1) + 'px';
        return $(el).css('font-size', elNewFontSize);
      };
      _results1 = [];
      while (el.scrollHeight > el.offsetHeight) {
        _results1.push(resizeText());
      }
      return _results1;
    })(el));
  }
  return _results;
};

autoSizeText(); // here is where we call the function.
//-->
</script>
</body>
</html>

Please give me any suggestions. All help will be appreciated.

  • 写回答

1条回答 默认 最新

  • douhai5835 2014-02-12 17:20
    关注

    If you are posting with Javascript check your Javascript. Also clear cache on the browser that is not working. and restart that browser.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 MATLAB APP 制作出现问题
  • ¥15 wannier复现图像时berry曲率极值点与高对称点严重偏移
  • ¥15 利用决策森林为什么会出现这样·的问题(关键词-情感分析)
  • ¥15 DispatcherServlet.noHandlerFound No mapping found for HTTP request with URI[/untitled30_war_e
  • ¥15 使用deepspeed训练,发现想要训练的参数没有梯度
  • ¥15 寻找一块做为智能割草机的驱动板(标签-stm32|关键词-m3)
  • ¥15 信息管理系统的查找和排序
  • ¥15 基于STM32,电机驱动模块为L298N,四路运放电磁传感器,三轮智能小车电磁组电磁循迹(两个电机,一个万向轮),怎么用读取的电磁传感器信号表示小车所在的位置
  • ¥15 如何解决y_true和y_predict数据类型不匹配的问题(相关搜索:机器学习)
  • ¥15 PB中矩阵文本型数据的总计问题。