Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
It's been a while since i've used PHP. How can i display a specific html page in a case statement. Basically i have a form with radio buttons on it and from each radio selectoin when they click the submit button i want it to display a different HTML page depending on wich radio button was selected. I know how to do everything up to the point that you tell it to launch that HTML page.
I know how to do it by putting the html code in the php code but i was wondering if i could keep the code in seperate files. One html and one php.Any help would be great.
C

Since you are wanting to open an HTML page and not a PHP page I am assuming you are not passing any form data to it. If that is the case you do not need to use PHP at all. A little javascript will do the trick.
Have the onSubmit of the form run a function with something like this.
function submitForm() {
var df = document.formname.radiofieldnameif (df[0].checked) (window.loaction=page1.html)
if (df[1].checked) (window.loaction=page2.html)etc...
}If you still wanted to do it solely in PHP, I think you would need to create an interim PHP page that retrieves the value of the radio button and then redirects to the correct html page. This might create a double-clicking sound (at least in IE) or a page-flash. Should be easy to test.
The interim page could look something like this (use the html page name as the value for each radio button option):
if ($_POST['radioBtnName']) {
$pageValue = $_POST['radioBtnName'];
Header("Location: ".pageValue);
else {
//Put error handling here
}Michael J

use the include function
<?php
include_once("YOUR HTML FILE.html")
?>FBI Agent
AIM: EliteAssassin187

![]() |
xml and asp
|
Frontpage2002 display fol...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |