Topic: form action (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=28714" title="Pages that link to Topic: form action (Page 1 of 1)" rel="nofollow" >Topic: form action <span class="small">(Page 1 of 1)</span>\

 
Boudga
Maniac (V) Mad Scientist

From: Jacks raging bile duct....
Insane since: Mar 2000

posted posted 12-08-2006 19:40

I have a web page with a form and a select dropdown box with a yes or no value. I want to make the form action go to one of two pages based on what the user selects. I realize I'm probably going to have to submit the form to itself to write the decision but I'm not sure how to make it POST to either page based on the user input after the user submits the form.

DL-44
Lunatic (VI) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 12-08-2006 20:03

couple things -

1) in this case, why not just have two links instead of a form? (why make more work for the user??)

2) assuming the form is the way to go

- the action will define the page to send the suer to
-- you can only specify one url for the action
- the input of the form will send a variable to that page
- the page will read the variable and do one of two things:
-- redirect to the appropriate page
-- include the appropriate content (my preferred method)

Nemesis
Bipolar (III) Inmate

From: Uranus
Insane since: Aug 2003

posted posted 12-08-2006 22:04

Although I don't see the point in using a form for that either, personally I would just use javascript to redirect the page after an onclick or onselect event.

Of course if they have javascript disabled....

Jason

Lurch
Paranoid (IV) Inmate

From: Behind the Wheel
Insane since: Jan 2002

posted posted 12-08-2006 23:12

i agree, but since this is in server side scripting, i assume that some, errr... server side scripting can be included..

i agree with the point that they may as well just be links, but depending on the case, dropdown may be the way to go. assuming it is, you could go with the javascript onclick/onselect event, and if you wanted to be sure that users without js enabled could use your page, then include some server side scripting.

even though it automatically goes to the page on select with js, you could include a submit button after the select field, and send it to a function (php, asp, cfm, whaaatever) that takes the value passed and redirects you to the correct page.

all of this seems overkill though, when two links would do the same trick

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 12-09-2006 01:06

I'm confused, Lurch... you want to make sure that the page has some link to server-side scripting, just because it's in this forum? I say that DL's solution is the best. It's not like the user can turn off hyperlinking. If you need them to go to one page, or another page, then just give them a pair of links and title one 'yes' and the other 'no'.


Justice 4 Pat Richard



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu