Jump to content

form will not post


rthomson

Recommended Posts

Hi, I am having a problem with my form.  It posts fine on Firefox 3.6 on my MAC, but not on Safari 5 on my MAC.  It also does not work Internet Explorer 9, Firefox 4 or Google Chrome on a windows box.  Basically it posts back to itself, no email is sent and it does not hit my sql database.

 

Here is the pertinent code to my index.html file...

<script type="text/javascript">
function showMonth(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","reserv.php?q="+str,true);
xmlhttp.send();
}
</script>
<form method="post" action="resersend.php">
<p><font face="arial" size="2" color="#336600">Reservation month:</font>
<select name="months" onchange="showMonth(this.value)">
<option value="" selected="selected">Choose One</option>
<option value="May 2011">May 2011</option>
<option value="June 2011">June 2011</option>
<option value="July 2011">July 2011</option>
<option value="August 2011">August 2011</option>
<option value="September 2011">September 2011</option>
<option value="October 2011">October 2011</option>
<option value="November 2011">November 2011</option>
<option value="December 2011">December 2011</option>
<option value="January 2012">January 2012</option>
<option value="February 2012">February 2012</option>
<option value="March 2012">March 2012</option>
<option value="April 2012">April 2012</option>
</select>
</form></p>

 

Here is the reserv.php file (code) that works with the html file....

<?php

$q=$_GET["q"];

$con = mysql_connect('my_host', 'my_user', 'my_pwd');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$sql="SELECT *
      FROM daterange
  WHERE DEND > DATE(NOW())
  AND STATUS='A' AND MONTH = '".$q."'
      ORDER BY RID, DATE, SITE";

$result = mysql_query($sql);


// Determine the number of reservation dates
$number = mysql_numrows($result);


// Create drop-down menu of reservation dates
print "<font size=\"3\" face=\"Arial\"><b>Select Your Reservation:</b><br>
<form action=\"resersend.php\" method=\"post\">
<select name=\"RID\">
    <option value=\"\">Choose One</option>";

for ($i=0; $i<$number; $i++) {
     $RID = mysql_result($result,$i,"RID");
     $DATE = mysql_result($result,$i,"DATE");
     $SITE = mysql_result($result,$i, "SITE");
 $PRICE = mysql_result($result,$i, "PRICE");
     print "<option value=\"$RID\">$DATE, $SITE, $PRICE</option>";
}

print "</select><p align=left><label><font size=\"3\" face=\"Arial\">First Name: <input type=\"text\" name=\"FNAME\" size=\"50\" maxlength=\"50\" tabindex=\"1\"<br>";

print "<p align=left><label>Last Name: <input type=\"text\" name=\"LNAME\" size=\"50\" maxlength=\"50\" tabindex=\"2\"<br>";

print "<p align=left><label>Address Line 1: <input type=\"text\" name=\"ADDR1\" size=\"50\" maxlength=\"50\" tabindex=\"3\"<br>";

print "<p align=left><label>Address Line 2: <input type=\"text\" name=\"ADDR2\" size=\"50\" maxlength=\"50\" tabindex=\"4\"<br>";

print "<p align=left><label>City: <input type=\"text\" name=\"CITY\" size=\"50\" maxlength=\"50\" tabindex=\"5\"<br>";

print "<p align=left><label>State (abbrev.): <input type=\"text\" name=\"STATE\" size=\"2\" maxlength=\"2\" tabindex=\"6\"<br>";

print "<p align=left><label>Zip Code: <input type=\"text\" name=\"ZIP\" size=\"5\" maxlength=\"5\" tabindex=\"7\"<br>";

print "<p align=left><label>Contact Phone Number: (<input type=\"text\" name=\"PHONE1\" size=\"3\" maxlength=\"3\" tabindex=\"8\"";
print "<label>)<input type=\"text\" name=\"PHONE2\" size=\"3\" maxlength=\"3\" tabindex=\"9\"";
print "<label>-<input type=\"text\" name=\"PHONE3\" size=\"4\" maxlength=\"4\" tabindex=\"10\"<br>";

print "<p align=left><label>Email: <input type=\"text\" name=\"EMAIL\" size=\"50\" maxlength=\"50\" tabindex=\"11\"<br>";

print "<p align=left><input type=\"submit\" value=\"Book Now!\"
    name=\"submit\">";

print "<input type=\"reset\" value=\"reset\"
    name=\"reset\"></form>";


// Close the database connection
mysql_close($con);
?>

 

Anyone have any ideas?  I suspect it may have to do with the javascript in the index.html file, but I can't nail it down.  Thanks.

 

Link to comment
https://forums.phpfreaks.com/topic/237275-form-will-not-post/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.