Value of list - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Value of list

budatlithobudatlitho Posts: 1Member
Hello:
I've been struggling with retrieving a value from a list.
Here's my code, which displays a list of names and allows selection.
What I want to do is retrieve [color=Red]$row['id'][/color] value once the user makes a selection from the names in the list.
What is the syntax to find the "value" of the listbox? Does this have to reside in a form? I've tried $_POST[....various combinations], etc., but haven't found the correct coding.

*******************************************************************
<?php
if<?php require_once('Connections/Server.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">



Untitled Document


<?
mysql_select_db($database_server, $Server);
//make query to database
$query_Recordset1 ="SELECT firstname, lastname, id FROM members ORDER BY lastname";
$Recordset1 = mysql_query($query_Recordset1, $Server) or die(mysql_error());
echo '<select name="memberid">';
while ($row = mysql_fetch_array($Recordset1)) {
echo '',$row['firstname'], ' ', $row['lastname'],'';
}
echo '';
?>

Here's the result I want: [color=Red]$row['id][/color]


<?PHP
mysql_free_result($Recordset1);
?>
*******************************************************
Sign In or Register to comment.