PDA

View Full Version : list/menu (pulldown menu) help


tnan
11-27-2006, 04:03 AM
Newbie here....

just trying to make a simple list as an experiment in learning pull down menus. I made a pulldown menu with the options labeled "url1" and "url2", the value for it are real urls (foir example) www.url1.com (http://www.url1.com) and www.url2.com (http://www.url2.com) and then i have a submit button. I would like to simply have a user click on a url which would then open that url in a new window.

Sounds simple? Well clicking 'submit' doesnt do anything. I read that i need to have a cgi script in the ACTION within the form. Can someone verify this.

thanks in advance

davidj
11-27-2006, 09:04 AM
Here you are... in a nice purple. Im in a purple mood today!


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function goto() {

var win = document.getElementById('page');
var newWindow = window.open(win.value, 'newWin', '_blank');
newWindow.focus();

return false;
}
</script>
</head>
<body>
<select name="page" id="page" onchange="goto()">
<option selected="selected">Select</option>
<option value="www.page1.co.uk">www.page1.co.uk</option>
<option value="www.page2.co.uk">www.page2.co.uk</option>
<option value="www.page3.co.uk">www.page3.co.uk</option>
<option value="www.page4.co.uk">www.page4.co.uk</option>
</select>
</body>
</html>

tnan
11-27-2006, 04:45 PM
thanks for the reply....(since you're in the purple mood here you go)

I had one question though......now how can I pull the options in the dropdown menu from my database. I currently have one of my columns in my db called "url"...so basically my form pulls the label from my database and the value is the actual url.

I currently made it happen, retrieving the label and value from my 'recordset' but again I can't get the submit button to respond.

davidj
11-27-2006, 04:48 PM
run through the php vids on this site

this will give you a better understanding of PHP. I do take it your using PHP

tnan
11-27-2006, 07:52 PM
oh wow! the videos really helped!! it explained everything....the only thing that left me blank was no actual submit button was included based on the result of the drop down menu. For example in the video, there was the car make, car model but no 'submit' button to show you how to onto the result (i.e. the car model url).
My guess is simply adding a 'submit' button in the form, but i'm not sure what to add to tell it to goto the url. (Do i place a url in the ACTION within the form?)

davidj
11-27-2006, 07:59 PM
you could add a submit button or you can use the onChange event as i have with the first dropdown

if you follow the tut to help dynamicaly create the dropdown values
then come back and we'll sort the rest out

tnan
11-27-2006, 08:13 PM
thanks for your help.....the vids halped a lot....