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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run different .php file depending on radio button 1

Status
Not open for further replies.

SM777

Technical User
Mar 7, 2001
208
GB
Is it possible to run two different .php scripts depending on a radio button selection? I don't mean run a script when a radio button changes. When the submit button is pressed, the setting of the radio button determines which file to cal

A simple form with two radio buttons and submit button

If radio button A set, when submit pressed run buttona.php
If radio button B set, when submit pressed run buttonb.php



 
Two ways come to mind...

1) Javascript to change the action of the Form when either radio button is chosen

2) Make a PHP wrapper which just reads the value of the radio button then
if (buttonA) {
include(scriptA);
} else {
include(scriptB);
}

-Rob
 
Option 2) was good.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top