Forums

This topic is locked

try to get value from select statement

Posted 03 Apr 2008 16:10:55
1
has voted
03 Apr 2008 16:10:55 David Johnson posted:
I have a select statement that I populate with client names from my database. Once the user selects a client name I want to have a button for them to click on that will pass the client name they have selected to my delete page. The problem is that I always get the first record from the retrive and not the one they selected. Any help would be appriciated. Here is my code:

<form id="form1" name="form1" method="post" action="">
<p><strong>Select Client to be Deleted:</strong>
<select name= "del_client">
<?php
do {
?>
<option value="<?php echo $row_clients['client_name']?>"<?php if (!(strcmp($row_clients['client_name'], $row_clients['client_name']))) {echo "selected=\"selected\"";} ?>><?php echo $row_clients['client_name']?></option>
<?php
} while ($row_clients = mysql_fetch_assoc($clients));
$rows = mysql_num_rows($clients);
if($rows > 0) {
mysql_data_seek($clients, 0);
$row_clients = mysql_fetch_assoc($clients);
}
?>
</select>
</p>
<p> </p>
<p><strong>Click to Delete Client</strong>:
<input name="Submit" type="submit" onclick="MM_goToURL('parent','/licenses/rem_client2.php?id=<?php echo $row_clients['client_name']; ?>');return document.MM_returnValue" value="Submit" />
</p>
<p> </p>
</form>

Reply to this topic