Hi,
I have a js drop down that passes a variable (country) to a php form. The variable needs to appear in the form (so the submitter doesn't have to choose one again) and also be passed along with the form to a MySQL db and an email.
Depending on the country chosen a different email is sent using a group of arrays.
The dropdown sends the user to cwint.php?country=COUNTRY
where country is hardcoded into the url.
I use $country = $_GET['country']; to show the country chosen in the form with by echo()ing it.
What I can't figure out is how to have the same country variable passed along with what they fill out in the form to the db.
<?php
include ('D1g1taL.inc');
$country = $_GET['country'];
// Display the form
// if ($_POST['submit']) {
if (isset($_POST['submit'])) {
// process form
$timenow = date("Y-m-d h:i:s");
$site = 'Curbworld';
<div align="center">
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ; ?>">
<center>
<table border="1" width="484">
<tr>
<td width="205">
First Name:<b> <font color="#FF0000">*</font>
</b>
</td>
<td width="263"><input type="Text" name="firstname" size="20"></td>
</tr>
<tr>
<td width="205">
Last Name:<b> <font color="#FF0000">*</font>
</b>
</td>
<td width="263"><input type="Text" name="lastname" size="20"></td>
</tr>
<tr>
<td width="205">
Country:<b>
</b>
</td>
<td width="263"><?PHP echo ("$country"); ?> <br>
<input type="hidden" name="country" value="$country"></td>
</tr><tr>
<td width="205">
Postal Code:</td>
<td width="263"><input type="Text" name="postcode" size="7"></td>
</tr><tr>
<td width="205">
Email:<b> <font color="#FF0000">*</font>
</b>
</td>
<td width="263"><input type="Text" name="email" size="20"></td>
</tr>
</table>
</center>
<p align="center">
<input type="Submit" name="submit" value="Submit Information">
<input type="Reset" name="reset" value="Reset Form">
</p>
</form>
</div>
Everything works fine except that because the country variable is not passed with the form, the form doesn't know where to send the email so none is sent. Also, the data is inserted to database except the country.
Thanks,
Scurvy
If you need more let me know.