Computing.Net > Forums > Web Development > post HTML page in PHP

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

post HTML page in PHP

Reply to Message Icon

Name: chrisjasp
Date: May 5, 2005 at 21:56:41 Pacific
OS: mandriva
CPU/Ram: 1.3
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: May 5, 2005 at 22:29:56 Pacific
Reply:

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.radiofieldname

if (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


0

Response Number 2
Name: FBI Agent
Date: May 6, 2005 at 06:11:43 Pacific
Reply:

use the include function
<?php
include_once("YOUR HTML FILE.html")
?>

FBI Agent

AIM: EliteAssassin187


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


xml and asp Frontpage2002 display fol...



Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: post HTML page in PHP

link in php www.computing.net/answers/webdevel/link-in-php/3999.html

perl-HTML page contsruction www.computing.net/answers/webdevel/perlhtml-page-contsruction/4316.html

Retrieving Secured Page via PHP www.computing.net/answers/webdevel/retrieving-secured-page-via-php/3024.html