Page 1 of 1
FORM and 3 buttons. How to make goto URL
Posted: Tue Apr 13, 2010 6:32 am
by phpuse
There is a FORM, INPUT type="text". And there are three buttons. Kindly ask you to help with this: after you put some info to the form, you push one button and you go to one URL. If you push another button, you go to different URL. And if you push the third button you go to the third different URL. But the info for this goto is taken from the INPUT type="text" form. It is 5-7 figures that are added to the URL after "?". It looks like that:
http://www.somesite.com/archive.php?idx= and here is the info from the form.
Re: FORM and 3 buttons. How to make goto URL
Posted: Tue Apr 13, 2010 9:33 am
by omniuni
What is your form Action and Method?
Re: FORM and 3 buttons. How to make goto URL
Posted: Tue Apr 13, 2010 10:06 am
by AbraCadaver
phpuse wrote:There is a FORM, INPUT type="text". And there are three buttons. Kindly ask you to help with this: after you put some info to the form, you push one button and you go to one URL. If you push another button, you go to different URL. And if you push the third button you go to the third different URL. But the info for this goto is taken from the INPUT type="text" form. It is 5-7 figures that are added to the URL after "?". It looks like that:
http://www.somesite.com/archive.php?idx= and here is the info from the form.
You have two choices that I can think of:
First, each button needs an onclick that calls a javascript function passing the proper URL. The function needs to set the form action to the URL passed by the button and then submit.
Second, since it looks like you are using get instead of post, you can submit to one PHP page that collects the form data and then redirects to the proper page based upon which submit button was clicked (name).