Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open a new page? 1

Status
Not open for further replies.

MichaelLewis

Programmer
Feb 5, 2011
12
FR
I have a form with three radio buttons.

Selecting one of the first two buttons and then clicking the submit button will open page x which is another form asking for more info before going to page y to list data.

How do I go to page y (and pass on data in $yy) directly when the third radio button is selected?

Or better still, when any of the radio buttons get selected, how can I execute the listing code in the same page instead of clicking submit to go to another page to do the listing?

Thanks,
Michael
 
Cant really understand your question after reading it a few times. U mind posting the code so we can look at it and restructuring your question?
 
If I understand this correctly, you don;t want to open a new page, rather point your form to a different location or run a different script depending on what is selected.

Changing the forms location can be done with Javascript by either changing the form's action attribute, or getting all the relevant values and sending them in the query string to whatever page you need.

Or better still, when any of the radio buttons get selected, how can I execute the listing code in the same page instead of clicking submit to go to another page to do the listing?

This you can do by putting your listing code in the same page as your form, and adding a condition to run the code only when you know the form has been submitted.

I'm assuming you are using PHP (maybe Perl) what you would want to do is set up your form so it points to the samepage its on, and then set up your PHP code (listing script) to check for the forms submission and execute the listing code.

For instance

Code:
<form action="thispage.php" method="POST">
...
<input type="submit" name="process" value="Process Form">
</form>

<?PHP
if(isset($_POST{'process')){ /* [green]This checks if the form hs been submitted */ [/green]
/* Do PHP code here to process the form, or create the listings etc... */

}

?>



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
yea i agree. U need javascript to change the action attribute for the form depending on what is selected or use php to the page the form calls to check for different form data that may be sent when a radio button is checked. This can then display or do whatever you want once you enclose it in a condition in the called page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top