Jump to content

Recommended Posts

I have a php dropdown box with items from the database but I cant figure out how to make the items in the dropdown link to the details pages of those specific items. So for example the 3rd item in the dropdown is "Joe", when selected it should display the page with Joe's details.

 

 

<?php echo '<select name="Clients"><OPTION>'; 
echo "Select an option</OPTION>"; 
while ($row = mysql_fetch_array($client_select)){
$client_id = $row["client_id"];
$company_name = $row["company_name"]; 
echo "<OPTION value=\"$client_id\">$company_name</OPTION>"; 
} 
echo '</SELECT>';
?>

Link to comment
https://forums.phpfreaks.com/topic/270663-php-mysql-jump-menu/
Share on other sites

You need to use javascript if you want to have page elements be interactive without the use of a submit button. If you haven't used any javascript before, and this is functionality that you expect to use a lot of, I'd recomend at some point soon that you get the JQuery library (free download and you just link the page header to it much as you would a css file) and looking up some online tutorials - nettuts has a series of video tutorials here if that's what you like.

 

PHP doesn't interface directly with the user, it runs on the server side. As such it has no connection with mouse clicks or keyboard commands and it has no idea what values have been chosen or entered into forms untill they are sent back to the server. It can react conditionaly to a request from a web page (normaly via a submit button or a javascript function) and produce results accordingly, but it can't react to user input directly.

Link to comment
https://forums.phpfreaks.com/topic/270663-php-mysql-jump-menu/#findComment-1392209
Share on other sites

  • 2 weeks later...
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.