Jump to content

option value from PHP post


rthomson

Recommended Posts

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);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.