![]() |
![]() |
#1 (permalink) |
Crazy
|
[No idea] What's the best way to code a URL-generated from a form?
Hello,
I would like to create a URL link based on a pull-down menu on a website. There would be one pull-down menu for the month and another for the day. Example: they choose Feb 20, they would hit 'go' and they would be taken to the url: www.mysite.com/index.php?day=20&month=02 What is the best way to do this? Javascript? PHP? Something else entirely? Thank you. |
![]() |
![]() |
#3 (permalink) |
Crazy
Location: Salt Town, UT
|
That would need to be done in javascript.
Shouldn't be too hard... add unique "id" tags to everything in the form would be step 1, so you can easily grab your data from the fields. I'm a little rusty with javascript (everything I write in javascript takes five times the amount of time it should), but here's the basic idea: Code:
<form id="form_loc" name="loc"> Month: <select id="month" name="month"> <option value="01">Jan</option> <option value="02">Feb</option> </select><br> Day: <select id="day" name="day"> <option value="01">1</option> <option value="02">2</option> <option value="03">3</option> </select><br> <input type="submit" onClick="document.location = 'http://www.mysite.com/index.php?day=' + document.getElementById('day').value + '&month=' + document.getElementById('month'); return(false);"> </form> That should get your user to the page. But, if your url really looks like that, then you don't even need to mess around with javascript, creating a standard form and having it submit as a GET request will do the same thing. |
![]() |
![]() |
#4 (permalink) |
Devils Cabana Boy
Location: Central Coast CA
|
java script or visual basic script
if you are using php pages, go with java, if you are doing asp, go with Visial Basic Script
__________________
Donate Blood! "Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen |
![]() |
![]() |
#5 (permalink) | |
Crazy
Location: here and there
|
Quote:
__________________
# chmod 111 /bin/Laden |
|
![]() |
Tags |
code, form, idea, urlgenerated |
|
|