If-Then Go To Page?
Posted: Wed Feb 22, 2006 9:53 am
feyd | Please use
My question is: is there a way to use "$page_to" to actually select and go to a new page? The pages would be significantly different depending on the value of "$page_to", so a php?page_to= would be really ugly, I think.
Thanks.
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I'm not a developer, just taught myself a little php to extract info from a MySQL database. So, not evene really "newbie", more of "novice hack."
What I want to do now is use an HTML form with a select (drop-down), and use the resulting variable to select a new page to go to. I'm giving the user 3 options. So, basically, the php code so far looks like:Code: Select all
<?php
if (isset($_GET['action']) && $_GET['action'] == 'submitted') {
if ($_GET['router'] == 'enterInfo') {
$page_to = 'edititem3.php' ;
}
elseif ($_GET['router'] == 'reviewData') {
$page_to = 'reviewData.php' ;
}
elseif ($_GET['router'] == 'selectPrint') {
$page_to = 'goPrint.php' ;
}
}
} else {
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET">
<input name="router" type="radio" value="enterInfo">Enter New INFO<br>
<input name="router" type="radio" value="reviewData">Review Existing Info<br>
<input name="router" type="radio" value="selectPrint">Select & Print Reports<br>
<input type="hidden" name="action" value="submitted" />
<input type="submit" name="submit" value="Go Do It" />
</form>Thanks.
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]