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

$_Post Variables 1

Status
Not open for further replies.

ZOR

Technical User
Jan 30, 2002
2,963
GB
I did not like to hijack the posting next to this, however the answer may be in the other thread, just want confirmation.

I seem to be having lots of forms that are there just to redirect. Is it possible to have one that is commonly used by several pages/forms to redirect, or do Posted values stay around all the time.

A page having multiple statements like:

if (isset($_POST['V1'])===true) {
header('location: Test1.php');
exit();
}

etc,etc

Hope it doesn't sound as confusing as I am. Thanks
 
POSTed values are only good for one page. If you want them to stick around, you have to put them in hidden fields (or real fields) in a form generated by your script.
 
Thankyou Miros, thats just what I wanted to hear. So I can have a switchboard type page to serve redirection. Have a star for the good news.
 
Zor

if you are using forms as a navigation function then consider using links instead. Usually a site design will not care if the navigation commands are passed openly in the url. in that way you save the overhead of coding forms.

secondly: it sounds like your design may be a candidate for a switchboard or the despatch method of site design. in this methodology you have a single page that every link points to. you pass a command to the page either by the url or in a hidden field of a form to tell the despatcher what to do, which then calls a script. in this way you never have to do a forced redirect.

something like
Code:
<a href="index.php?action=showUsers">Show Users</a><br/>
<a href="index.php?action=register">Register </a><br/>
and in the index.php
Code:
$action = isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action'])?$_GET['action']:"");
switch ($action){
 case "register":
 //include the relevant files
 //call the relevant functions
 //output the relevant html
 break;

 case "showUsers":
 //include the relevant files
 //call the relevant functions
 //output the relevant html
 break;
 
 default:
 //something

}

more details at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top