I have some code that I have written that pulls out data from a simple database into a dropdown menu.

mysql_connect('localhost' , 'databasename', 'password');
$result=mysql_query("SELECT * FROM Persons");
<select name="Persons">
<option value="<?php echo $rows; ?>"> <?php echo $rows; ?></option>

I would like to update this to a jump menu so that if one of the items of data is selected the user is taken to a page showing all the data from the database about that record.

So I need a form script and a results page please....

All help appreciated.

Many thanks

Recommended Answers

All 5 Replies

Member Avatar

that's probably javascript Steve.

Thank you - I've had a play with that today, but can't seem to get it working at all. eg. I'm not getting the user to be sent to the next page of information about the item they selected in the menu.....

I assume this must be a fairly frequently asked question, but I can't see any examples on the site here anywhere?

All help appreciated!

Member Avatar

if you want a simple sol:

function jump(param){
    var indx  = param.selectedIndex;
    var selVal = param.options[indx].value;
    var url  = selVal + '.php';
    window.location.href = url;
    return true;


<select name="myselect" onchange="jump(this.form.myselect);">
  <option value="index">Home</option>
  <option value="profile">User Profile</option>
  <option value="contact">Contact Us</option>

not tested

Thanks, but I'm unsure how this fits in with my code and how to integrate the two...

Member Avatar

The value in tje optipn ips the first part of the page you want to direcct to

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.