Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [No idea] What's the best way to code a URL-generated from a form? (https://thetfp.com/tfp/tilted-technology/85459-no-idea-whats-best-way-code-url-generated-form.html)

TheProf 03-15-2005 03:52 PM

[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.

exizldelfuego 03-15-2005 04:11 PM

PHP seems to make sense for this to me. But then, I've had my head buried in PHP for the past couple of weeks so I'm seeing it EVERYWHERE!

Rawb 03-15-2005 06:21 PM

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.

Dilbert1234567 03-30-2005 08:29 AM

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

theFez 03-30-2005 09:03 PM

Quote:

Originally Posted by Dilbert1234567
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

since this needs to be client side, only use vbscript if you only want your page to work on ie.


All times are GMT -8. The time now is 01:46 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54