Forum Home
Press F1
 
Thread ID: 57278 2005-04-28 08:45:00 php - html help Morgenmuffel (187) Press F1
Post ID Timestamp Content User
349835 2005-04-28 08:45:00 Greetings all

I am having a problem with some code i am writing

I can't work out how to call a different page when a specific condition is valid

if ($valid) {
echo "Form filled successfully!";
//insert_links.php; want to call a page here
exit;
}

it is probably really simple but it's not making sense

as usual
any help would be much appreciated
Morgenmuffel (187)
349836 2005-04-28 10:53:00 are you using include() or what?

Try looking at php.net

You know what is really good. irc.freenode.net's #php channel. If you can go on there, you can get quick help. If you do, use http://www.pastebin.com/ to paste your code to, because you will get kicked from irc if you post too much lines.
mejobloggs (264)
349837 2005-04-28 11:00:00 There's a few ways I know of that can do what you want. The first is the simplest - use an include statement:


include("mylinks.php");

This will simply parse mylinks.php in addition to the current script. Another way to do essentially the same thing is to open the page as a file like so:


readfile("my.web.site);

If mylinks.php outputs a regular HTML page then neither of these approaches are appropriate since you'll end up with structural HTML in all the wrong places.

Another way is to initiate a browser redirect by sending the appropriate header data:


header("Location: my.website);

There is a limitation to using this method in that the page that calls the header function can't actually output anything. If you do want to output something before they're redirected you'll need to use a refresh meta tag in your actual HTML, as described here (www.w3schools.com) [w3schools].
mird (7969)
349838 2005-04-28 11:21:00 Thanks all for the help,

I'll try them tomorrow and post back if i still have problems
Morgenmuffel (187)
1