PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
orbdrums
Forum Commoner
Posts: 82 Joined: Wed Sep 14, 2011 11:42 pm
Post
by orbdrums » 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:
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" />
Is there a way to accomplish this without using the submit button? I want to avoid another mouse click. Thanks for any assistance.
C
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Fri Jul 26, 2013 8:31 pm
The only question I could get from that was how to submit the form automatically without having to click the button. Is that it?
Code: Select all
<select name="v_friend_of_id" id="v_friend_of_id" onchange="this.form.submit();">
orbdrums
Forum Commoner
Posts: 82 Joined: Wed Sep 14, 2011 11:42 pm
Post
by orbdrums » Fri Jul 26, 2013 10:44 pm
Yes. I don't want users clicking on two places when it's not necessary...
requinix
Spammer :|
Posts: 6617 Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA
Post
by requinix » Fri Jul 26, 2013 11:41 pm
Okay. So... problem solved?
orbdrums
Forum Commoner
Posts: 82 Joined: Wed Sep 14, 2011 11:42 pm
Post
by orbdrums » Sat Jul 27, 2013 1:41 pm
Awesome!! Thanks for your help!