Jump to content

trouble with dropdown menu ....simplifie....


nec9716

Recommended Posts

ok I have try to cut the script  a bit

so the dropdown menu work but not showing the right value ( when update is selected ) always the lowest ID is show

it might not be readable but I have try to post the full script (400 lignes )...but not much respond...which I understand  :)

 

 

$result = conn($sql);
show_form($result);

function show_form($handle='',$data='')

//variables
$row = mysql_fetch_array($handle);
$query6 = "SELECT userid, uname FROM user";
$result6 = mysql_query($query6);
$tpname = $row['pname'];
$id = $row['id'];
//end of variables

echo "<input type="hidden" value="' .$row['id'] .'" name="id">";
if(isset($_POST['pname']))
$tpname = $_POST['pname'];
else
$tpname = 1;

echo'<select name="pname" size="1" onchange="setItemListBox()">';
while($row = mysql_fetch_array($result6, MYSQL_NUM))
{
if($row[0] == $tpname)
echo '<option value="' . $row[0] . '" selected>' . $row[1] . '</option>';
else
echo '<option value="' . $row[0] . '">' . $row[1] . '</option>';
}
echo '</select>';
echo "</td >";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.