How to pass dropdown list value in PHP without form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ajentp
Forum Newbie
Posts: 6
Joined: Thu Sep 10, 2009 10:46 pm

How to pass dropdown list value in PHP without form

Post by ajentp »

Hi

I am trying to make a PHP mail script, where -based on customer feedback- e-mail template can be sent. Emails template are listed in drop down list at the top of the page. Underneath, is a display of customer records. Each record has a button ,if clicked, it will send the e-mail template as selected in the dropdown list.



I am having difficulty to pass parameter form dropdown list to PHP file where that parameter will be used to select the template from the database.

Here is the code:
<code>
$qE = sprintf("SELECT * From mail");
$resE = mysql_query($qE);
//$roE = mysql_fetch_array($resE);
$rowcount = mysql_num_rows($resultE);
echo "<select size='1' name='temp'>";

for($z=0; $z< $rowcount; $z++)
{
$roE = mysql_fetch_array($resE);
$title = $roE ['name'];
$mid = $roE ['id'];
echo"<option value='$id'>$title</option>";

//////////////////////////////////////////////// I would like to pass $id as parameter whose name is temp
}
echo"</select></font><br>";

do {
//////////////////////the data below is selected from another table whose query not shown here
$name = $row ['name'];
$ymail = $row ['ymail'];
$fname = $row ['fname'];
$fmail = $row ['fmail'];
$domain= $row ['url'];
$comments = $row ['comments'];

?><div style="border:1px solid #800080; position: relative ; width: 715px; z-index: 2; left: 4px; top: 3px; padding: .3em; background-color: #FFCC99" id="layer3">
<p align="center"><b><font face="Tahoma" size="4">Record <?php echo $x; ?> </font></b><p align="left">
<font face="Tahoma" size="2"><b>Name:</b> <?php echo $name; ?></font><br>
<font face="Tahoma" size="2"><b>Email:</b> <?php echo $ymail; ?></font><br>
<font face="Tahoma" size="2"><b>Friend's Name:</b> <?php echo $fname; ?></font><br>
<font face="Tahoma" size="2"><b>Friend's Email:</b> <?php echo $fmail; ?></font><br>
<font face="Tahoma" size="2"><b>Page Forward:</b> <?php echo $url; ?></font><br>
<font face="Tahoma" size="2"><b>Comments:</b> <?php echo $comments; ?></font><br>
<font face="Tahoma" size="2"><b>Email Template:</b>

<?php //echo temp;
$temp = $_REQUEST['temp'];
//echo $temp;?>

/////////////////////////////////////here is my problem: the very last parameter temp. This is being forwarded as empty.

<input type="button" name="submit2" value="Email" onClick="document.location.href='maincheck.php?name=<?php echo $name;?>&ymail=<?php echo $ymail;?>&temp=<?php echo $temp;?>'"/></div>

<?php $x++;} while ($row = mysql_fetch_array($result));
?>
</code>

Any help is very appreciated.

Thanks
Post Reply