Jump to content

redirect help


phpisawesome

Recommended Posts

<?php
session_start();
$_SESSION['message'] = "Text from script"; //sets message to a session variable.
header("Location: new_page.php"); //redirects to new_page.php in 0s
echo $_SESSION['message']; //echos out Text from script
?>

Link to comment
Share on other sites

one way, correcting previous post

 

<?php
session_start();
if ($_GET['show'] == 1) {
   echo $_SESSION['message']; //echos out Text from script
} else {
    $_SESSION['message'] = "Text from script"; //sets message to a session variable.
    header("Location: new_page.php?show=1"); //redirects to new_page.php in 0s
    exit;
}
?>

Link to comment
Share on other sites

So when I click the link I want it to perform the action on the php action page and on the page it redirects to display what it needs to display

 

So here's an example

 

Click here to add me as a friend!

 

So when you click here it does the action in the php file...and it redirects you to the main friends page but displaying the results from the action page...

Link to comment
Share on other sites

store the value that needs to appear on the second page, then retrieve it and display it on the second page. i would use a SESSION variable to store the value on the first page, then when the visitor arrives on the second page, i would echo the value of that SESSION variable. just like my example, but splitting it onto 2 pages instead of just 1 like I did.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.