Click to See Complete Forum and Search --> : [RESOLVED] Php Drop Down Menu Help


airforcefc
02-16-2008, 11:40 PM
Hello,

I have the following, I basically want the Member to select all other members within the database but at the same time not displaying his own member name within the select menu, stopping him from sending a message to himself.


<?php

mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name ORDER BY TippingName ASC";
$result=mysql_query($sql);
?>
<select name="to_member">
<option value="" selected> - - Select - - </option>
<?php
while($rows=mysql_fetch_array($result)){
?>
<option value="<? echo $rows['TippingName']; ?>"><? echo $rows['TippingName']; ?></option>
<?php
}
?>
</select>
<?php
mysql_close();
?>

bathurst_guy
02-16-2008, 11:55 PM
Maybe something like this?
while($rows=mysql_fetch_array($result)){
if($rows['TippingName']!=$username){
?>
<option value="<? echo $rows['TippingName']; ?>"><? echo $rows['TippingName']; ?></option>
<?php
}
}

airforcefc
02-17-2008, 12:24 AM
Thanx for that, works perfectly :)

bathurst_guy
02-17-2008, 03:44 AM
No prob.