Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7500745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:17:17+00:00 2026-05-29T20:17:17+00:00

PHP Redirect with Post Data Hi, I am a newbie PHP programmer and trying

  • 0

PHP Redirect with Post Data

Hi,

I am a newbie PHP programmer and trying to code a small blog.

I will explain what I am trying to do.

  • page1.php: Has a table of all posts in the blog
  • page2.php: This page has a form where you can add a Post

Page 2 posts to itself and then processes the data, if it successful then uses header() to redirect back to page1 which shows the table.

Now what I want to do is to be able to have a small message on page 1 above the table saying your blog post has been successfully submitted but I’m not sure how I can pass data back to page 1 after the form processing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:17:19+00:00Added an answer on May 29, 2026 at 8:17 pm

    Set it as a $_SESSION value.

    in page2:

    $_SESSION['message'] = "Post successfully posted.";
    

    in page1:

    if(isset($_SESSION['message'])){
        echo $_SESSION['message']; // display the message
        unset($_SESSION['message']); // clear the value so that it doesn't display again
    }
    

    Make sure you have session_start() at the top of both scripts.

    EDIT: Missed ) in if(isset($_SESSION['message']){

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to redirect a PHP page and post data to that page without
I have a problem with php header redirect. I already spent hours trying to
i have tried this code to redirect a php page.but it s not working
I'm trying to redirect to a .php page if the $validForm variable is TRUE.
I used jQuery's .ajax function like: $.ajax({ type:POST, url:./index.php, data:{ajax_fetch:1,action:fetch_devInfo,nwType:nw_type,devTSN:dev_tsn,devSTime:dev_sTime,devETime:dev_eTime,dev_gType:dev_graphType}, dataType:xml, error:errHandler, success:function(xml,textStatus) {
Ajax: $.ajax({ url: 'process.php', type: 'post', data: 'loginName=' + $(#loginName).val() + 'loginPass=' + $(#loginPass).val(),
I'm writing a php script that will fetch data from a given URL and
So earlier I asked this question: JQuery Login Redirect. Code Included The php file
Possible Duplicate: Redirect with POST data Is it possible for a script to redirect
I'm trying to get an html table from a dynamic php page on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.