Hi,
I want to retrieve a key value for the option selected in the drop down box,and i also want to you to tell me how to use that key value

<select name="role" style="width: 145px">';
		$result=selecttbl("ugname","ugroup");
		while($nt=mysql_fetch_array($result))
		{
		print'<option>'.$nt[ugname].'';
                                print'</option>';
		}
		print'</select></td>
print'<option value="{$nt[ugname]}">'.$nt[ugname].'';
print'</option>';

If you have any key column other than ugname then you can use that as value.

Hi,
I want to retrieve a key value for the option selected in the drop down box,and i also want to you to tell me how to use that key value

<select name="role" style="width: 145px">';
$result=selecttbl("ugname","ugroup");
while($nt=mysql_fetch_array($result))
{
print'<option>'.$nt[ugname].'';
print'</option>';
}
print'</select></td>

<p><select" name="optcountry" class="">
<option value="" selected></option>
<?php  
   //GET ALL THE COUNTRIES IN DATABASE

       [your connection and query to database here]

	while ($row = mysql_fetch_assoc($results)) {
	$countries = $row['countries_name'];
    echo "<option value=\"$countries\">$countries</option>";
} 
	?>
  </select></p>

to use that...click the value inside your form.
call the $_POST['optcountry'] this will return the value.

Hi,
I want to retieve option value for the corresponding name in the drop down box,please help me out,i tried in the below method,but it doesn't go well.

<select name="role" style="width: 145px">';
$result=selecttbl("ugname","ugid","ugroup");
while($nt= mysql_fetch_assoc($result))
{
print'<option value="'.$nt[ugid].'">'.$nt[ugname].'';
print'</option>';
}
 print'</select>
Comments
Creating duplicate threads wouldn't help you in any way.

I think you problem is that you don't have quotes around the $nt array indexes. This should fix your problem:

print'<option value="'.$nt['ugid'].'">'.$nt['ugname'].'';
This article has been dead for over six months. Start a new discussion instead.