Using php in a drop down list...
Posted: Fri Jul 26, 2013 7:42 pm
I want to create a drop down that will use a static link but pass a value from a dynamic list. I can't seem to get this to work without using a submit button. Here is an example of my code:
Is there a way to accomplish this without using the submit button? I want to avoid another mouse click. Thanks for any assistance.
C
Code: Select all
<form id="FriendForm" name="FriendForm" method="post" action="friend-display.php">
<select name="v_friend_of_id" id="v_friend_of_id">
<option value=0>Select Friend</option>
<?
$result = mysql_query($query_details);
while ($row = mysql_fetch_assoc($result))
{
if ($row['friend_of'] == $v_mbr_id)
{
$v_friend_of_id = $row['mbr_member_id'];
} else {
$v_friend_of_id = $row['friend_of'];
}
?>
<option value="<? echo $v_friend_of_id; ?>"><? echo $v_friend_request_fname." ".$v_friend_request_lname; ?></option>
<?
}
?>
</select>
<input type="submit" name="Submit" value="Visit Friend" />
C