Jump to content

rthomson

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

rthomson's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi, During post of my form I am trying to send some table values. The three field values (DATE, SITE, PRICE) that I want to send are attached to the id field (RID) in the daterange table. The variable $FTGRID is attached to the RID field. Here is the structure of the daterange table and the code from the php page related to the email is below. Do I need to pre-define variables for these three field values? daterange Table: RID DEND MONTH DATE SITE PRICE STATUS if ( $validationFailed === false ) { # Email to Form Owner $emailSubject = FilterCChars("Your Reservation"); $emailBody = "Reservation Date : \n" . "Site : \n" . "Price : \n" . "Fname : $FTGFNAME\n" . "Lname : $FTGLNAME\n" . "Addr1 : $FTGADDR1\n" . "Addr2 : $FTGADDR2\n" . "City : $FTGCITY\n" . "State : $FTGSTATE\n" . "Zip : $FTGZIP\n" . "Phone : $FTGPHONE1" . "- $FTGPHONE2" . "- $FTGPHONE3\n" . "Email : $FTGEMAIL\n" . "Payment Method : $FTGPM\n" . "Last Four CC : $FTGC4\n" . ""; $emailTo = 'u@yahoo.com'; $emailFrom = FilterCChars("inquiry@c.com"); $emailHeader = "From: $emailFrom\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"UTF-8\"\n" . "Content-transfer-encoding: 8bit\n"; mail($emailTo, $emailSubject, $emailBody, $emailHeader); # Confirmation Email to User $confEmailTo = FilterCChars($FTGEMAIL); $confEmailSubject = FilterCChars("Confirmation of Reservation"); $confEmailBody = "Reservation Date : \n" . "Site : \n" . "Price : \n" . "Fname : $FTGLNAME\n" . "Lname : $FTGLNAME\n" . "Addr1 : $FTGADDR1\n" . "Addr2 : $FTGADDR2\n" . "City : $FTGCITY\n" . "State : $FTGSTATE\n" . "Zip : $FTGZIP\n" . "Phone : $FTGPHONE1" . "- $FTGPHONE2" . "- $FTGPHONE3\n" . "Email : $FTGEMAIL\n" . "Payment Method : $FTGPM\n" . "Last Four CC : $FTGC4\n" . ""; $confEmailHeader = "From: inquiry@c.com\n" . "MIME-Version: 1.0\n" . "Content-type: text/plain; charset=\"UTF-8\"\n" . "Content-transfer-encoding: 8bit\n"; mail($confEmailTo, $confEmailSubject, $confEmailBody, $confEmailHeader);
  2. Thanks so much. That worked perfectly. I had close to what you did.
  3. Hi, when I submit a form I want to update a field in the "daterange" table. In the form the id field (RID) from "daterange" is selected prior to submit. Basically, I want to change the STATUS field to B (from A). The structure of daterange table is as follows: RID (key field) DEND MONTH DATE SITE PRICE STATUS What is the easiest way to accomplish this? Here is the code from the form (if it will help)... <?php //************************************** // Page load dropdown results // //************************************** function getTierOne() { $result = mysql_query("SELECT DISTINCT MONTH FROM daterange") or die(mysql_error()); while($tier = mysql_fetch_array( $result )) { echo '<option value="'.$tier['MONTH'].'">'.$tier['MONTH'].'</option>'; } } //************************************** // First selection results // //************************************** if($_GET['func'] == "drop_1" && isset($_GET['func'])) { drop_1($_GET['drop_var']); } function drop_1($drop_var) { include_once('db.php'); $result = mysql_query("SELECT * FROM daterange WHERE DEND > DATE(NOW()) AND STATUS='A' AND MONTH='$drop_var' ORDER BY DATE, SITE") or die(mysql_error()); echo '<select name="RID"> <option value=" " disabled="disabled" selected="selected">Choose a Reservation</option>'; while($drop_2 = mysql_fetch_array( $result )) { echo '<option value="'.$drop_2['RID'].'">'.$drop_2 ['DATE']. ', '.$drop_2 ['SITE']. ', '.$drop_2 ['PRICE'].'</option>'; } echo '</select> '; echo "<br />"; echo "</select><p align=left><label><font size=\"2\" face=\"Arial\">First Name: <input type=\"text\" name=\"FNAME\" size=\"50\" maxlength=\"50\" tabindex=\"1\"<br />"; echo "<p align=left><label>Last Name: <input type=\"text\" name=\"LNAME\" size=\"50\" maxlength=\"50\" tabindex=\"2\"<br />"; echo "<p align=left><label>Address Line 1: <input type=\"text\" name=\"ADDR1\" size=\"50\" maxlength=\"50\" tabindex=\"3\"<br />"; echo "<p align=left><label>Address Line 2: <input type=\"text\" name=\"ADDR2\" size=\"50\" maxlength=\"50\" tabindex=\"4\"<br />"; echo "<p align=left><label>City: <input type=\"text\" name=\"CITY\" size=\"50\" maxlength=\"50\" tabindex=\"5\"<br />"; echo "<p align=left><label>State (abbrev.): <input type=\"text\" name=\"STATE\" size=\"2\" maxlength=\"2\" tabindex=\"6\"<br />"; echo "<p align=left><label>Zip Code: <input type=\"text\" name=\"ZIP\" size=\"5\" maxlength=\"5\" tabindex=\"7\"<br />"; echo "<p align=left><label>Contact Phone Number: (<input type=\"text\" name=\"PHONE1\" size=\"3\" maxlength=\"3\" tabindex=\"8\""; echo "<label>)<input type=\"text\" name=\"PHONE2\" size=\"3\" maxlength=\"3\" tabindex=\"9\""; echo "<label>-<input type=\"text\" name=\"PHONE3\" size=\"4\" maxlength=\"4\" tabindex=\"10\"<br />"; echo "<p align=left><label>Email: <input type=\"text\" name=\"EMAIL\" size=\"50\" maxlength=\"50\" tabindex=\"11\"<br />"; echo '<input type="submit" name="submit" value="Book Now!" /><br />'; echo '<input type="reset" name="submit" value="Reset" /><br />'; } ?>
  4. I am having a slight problem with my dynamic form working in Internet Explorer 8. It functions properly in all browsers on Mac and Windows machines. I have a reservations form and when you choose a month in a drop down list, it dynamically creates another drop down with a list of reservation dates for that month. Well, in Internet Explorer it allows me to choose the month, but the second drop down never appears. All other browsers work fine. Anyone have any ideas?? Here is the pertinent code for index.php page... <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#wait_1').hide(); $('#drop_1').change(function(){ $('#wait_1').show(); $('#result_1').hide(); $.get("func.php", { func: "drop_1", drop_var: $('#drop_1').val() }, function(response){ $('#result_1').fadeOut(); setTimeout("finishAjax('result_1', '"+escape(response)+"')", 400); }); return false; }); }); function finishAjax(id, response) { $('#wait_1').hide(); $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } </script> <p align="left"> </p> <p align="left" class="home">Booking Form</p> <p align="left"><font size="2" face="Arial" color="#006600">Reservation Month:</font> <form action="resersend.php" method="post"> <select name="drop_1" id="drop_1"> <option value="" selected="selected" disabled="disabled">Choose One</option> <?php getTierOne(); ?> </select> <span id="wait_1" style="display: none;"> <img alt="Please Wait" src="ajax-loader.gif"/> </span> <span id="result_1" style="display: none;"></span> <br> <?php if(isset($_POST['submit'])){ $drop = $_POST['drop_1']; $tier_two = $_POST['tier_two']; echo "You selected "; echo $drop." & ".$tier_two; } ?></form> And here is the func.php page that works with index... <?php //************************************** // Page load dropdown results // //************************************** function getTierOne() { $result = mysql_query("SELECT DISTINCT MONTH FROM daterange") or die(mysql_error()); while($tier = mysql_fetch_array( $result )) { echo '<option value="'.$tier['MONTH'].'">'.$tier['MONTH'].'</option>'; } } //************************************** // First selection results // //************************************** if($_GET['func'] == "drop_1" && isset($_GET['func'])) { drop_1($_GET['drop_var']); } function drop_1($drop_var) { include_once('db.php'); $result = mysql_query("SELECT * FROM daterange WHERE DEND > DATE(NOW()) AND STATUS='A' AND MONTH='$drop_var' ORDER BY DATE, SITE") or die(mysql_error()); echo '<select name="RID"> <option value=" " disabled="disabled" selected="selected">Choose a Reservation</option>'; while($drop_2 = mysql_fetch_array( $result )) { echo '<option value="'.$drop_2['RID'].'">'.$drop_2 ['DATE']. ', '.$drop_2 ['SITE']. ', '.$drop_2 ['PRICE'].'</option>'; } echo '</select> '; echo "</p>"; echo "<p align=left>"; echo "<br>"; echo "</select><p align=left><label><font size=\"2\" face=\"Arial\">First Name: <input type=\"text\" name=\"FNAME\" size=\"50\" maxlength=\"50\" tabindex=\"1\"<br>"; echo "<p align=left><label>Last Name: <input type=\"text\" name=\"LNAME\" size=\"50\" maxlength=\"50\" tabindex=\"2\"<br>"; echo "<p align=left><label>Address Line 1: <input type=\"text\" name=\"ADDR1\" size=\"50\" maxlength=\"50\" tabindex=\"3\"<br>"; echo "<p align=left><label>Address Line 2: <input type=\"text\" name=\"ADDR2\" size=\"50\" maxlength=\"50\" tabindex=\"4\"<br>"; echo "<p align=left><label>City: <input type=\"text\" name=\"CITY\" size=\"50\" maxlength=\"50\" tabindex=\"5\"<br>"; echo "<p align=left><label>State (abbrev.): <input type=\"text\" name=\"STATE\" size=\"2\" maxlength=\"2\" tabindex=\"6\"<br>"; echo "<p align=left><label>Zip Code: <input type=\"text\" name=\"ZIP\" size=\"5\" maxlength=\"5\" tabindex=\"7\"<br>"; echo "<p align=left><label>Contact Phone Number: (<input type=\"text\" name=\"PHONE1\" size=\"3\" maxlength=\"3\" tabindex=\"8\""; echo "<label>)<input type=\"text\" name=\"PHONE2\" size=\"3\" maxlength=\"3\" tabindex=\"9\""; echo "<label>-<input type=\"text\" name=\"PHONE3\" size=\"4\" maxlength=\"4\" tabindex=\"10\"<br>"; echo "<p align=left><label>Email: <input type=\"text\" name=\"EMAIL\" size=\"50\" maxlength=\"50\" tabindex=\"11\"<br>";
  5. Sorry I am not real strong in coding. Can you tell me where to place your code in my page? And I believe it is AJAX. Thanks.
  6. Hi, just wondering if anyone can help with this?
  7. Sorry, I guess it would help to say what I am trying to do. When you choose a month it is supposed to populate the reservations select box. Then they would fill the remainder of the form and then it would post to reversend.php upon submit. I had it working separately, but it would not post in any browser except Firefox 3.6. I guess wc3 does not allow form inside form anymore....
  8. Hi, I have a form that I am trying to get working. The page is named "reserv_test.php". Not sure if I am trying to do to much, but can anyone tell me if this will work? If so, what do I need to do to make it work? Here is the code... <html> <head> <title>Booking Form</title> <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_test.php?q="+str,true); xmlhttp.send(); } </script> </head> <body> <div> <p align="left"><font face="arial" size="4"><u>Booking Form</u></font></p> <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><br /> <?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>"; Any help would be appreciated. Thanks.
  9. 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.
  10. Hi, what I am trying to do is "update" a mysql table via a form post, instead of "insert into" a table. I have a selected ID field or RID in the case of my code below... <?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); ?> Can someone help me update the selected RID field with the remainder of the fields from the form above, point me in the right direction? Thanks.
  11. Ok. Thanks. Can you give me an example of what the code might look like?
  12. Hi, I am trying to take the concatenated option value from my form and send it via email broken into the individual pieces. For example, in my code to follow... the ID field is the key field that generates what you see in the drop down list (Date, Site, Price). What I want to be able to do is separate (or un-concatenate, for lack of a better word) the values $Date, $Site, $Price so when the customer receives the email it reads this way because right now it only gives me the ID field (RID) to send via email... Date: 5/29-6/3/11 Site: Carterville Price: $1150.00 .... Any ideas on how to do this? Here is the code from my form..... <?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); ?>
  13. Sorry, but how do I mark it resolved?
  14. That work perfect. Thanks very much.
  15. When I submit my form the variables are sent to the url in my address bar and not to the php post page (resersend.php). Here is the pertinent html page code (index.html)... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <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> </head> <body> <form> <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> </body> </html> And here is the php code from the page (reserv.php) that works with the above html page... <?php $q=$_GET["q"]; $con = mysql_connect('My_host', 'my_user', 'my_password'); 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); ?> I am sure this is easy, but any help would be greatly appreciated. Thanks.
×
×
  • 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.