Value from listbox
Posted: Thu Oct 01, 2009 3:46 pm
Hello:
I've been struggling with how to retrieve a value from the user's selection from a dynamic listbox. What I want to retrieve is the value of $row['id'] once the user makes their selection from the firstname and lastname list. I've tried $_POST['memberid'] and most variations, but cannot seem to hit on the right syntax.
Here's my code:
<?php
if<?php require_once('Connections/ReunionServer.php'); ?> (!isset($_SESSION)) {//start session if not already started
session_start();
}
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?
mysql_select_db($database_ReunionServer, $ReunionServer);
//make query to database
$query_Recordset1 ="SELECT firstname, lastname, id FROM reunion_members ORDER BY lastname";
$Recordset1 = mysql_query($query_Recordset1, $ReunionServer) or die(mysql_error());
echo '<select name="memberid">';
while ($row = mysql_fetch_array($Recordset1)) {
echo '<option value="',$row['id'],'">',$row['firstname'], ' ', $row['lastname'],'</option>';
}
echo '</select>';
?>
<p>What I want to see is: $row['id'] </p>
</body>
</html>
<?PHP
mysql_free_result($Recordset1);
?>
I've been struggling with how to retrieve a value from the user's selection from a dynamic listbox. What I want to retrieve is the value of $row['id'] once the user makes their selection from the firstname and lastname list. I've tried $_POST['memberid'] and most variations, but cannot seem to hit on the right syntax.
Here's my code:
<?php
if<?php require_once('Connections/ReunionServer.php'); ?> (!isset($_SESSION)) {//start session if not already started
session_start();
}
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?
mysql_select_db($database_ReunionServer, $ReunionServer);
//make query to database
$query_Recordset1 ="SELECT firstname, lastname, id FROM reunion_members ORDER BY lastname";
$Recordset1 = mysql_query($query_Recordset1, $ReunionServer) or die(mysql_error());
echo '<select name="memberid">';
while ($row = mysql_fetch_array($Recordset1)) {
echo '<option value="',$row['id'],'">',$row['firstname'], ' ', $row['lastname'],'</option>';
}
echo '</select>';
?>
<p>What I want to see is: $row['id'] </p>
</body>
</html>
<?PHP
mysql_free_result($Recordset1);
?>