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!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Value of list

budatlithobudatlitho Posts: 1Member
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.

if<?php require_once('Connections/Server.php'); ?> (!isset($_SESSION)) {//start session if not already started
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

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]

Sign In or Register to comment.