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 6548857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:01:19+00:00 2026-05-25T12:01:19+00:00

To start, I am not asking if I can create a POST response from

  • 0

To start, I am not asking if I can create a POST response from one page to another without use of a form or one of the similar questions which may come to mind. At the start of several of my pages, I automatically force https security with the following require statement:

<?php
if($port == 80) {
    if($_SERVER['SERVER_PORT'] == 443) {
        header('Location: http://'. $_SERVER['HTTP_HOST'] . $_SERVER["REQUEST_URI"]);
        exit;
    }
} elseif ($port == 443) {
    if($_SERVER['SERVER_PORT'] == 80) {
        header('Location: https://'. $_SERVER['HTTP_HOST'] . $_SERVER["REQUEST_URI"]);
        exit;
    }
}
?>

where $port is set directly before calling the PHP require. In some instances where directing from a http to https (or simply changing the URL by person), any POST variables generated from the form on page 1 would be lost on the redirect.

Maybe I am asking the same question as the ‘no form’ but if so, any advice on how to handle based on the requirements is appreciated.

Thoughts

I could put everything into SESSION but this seems like a huge waste of resources. Unless somebody can really show otherwise, I don’t consider this a solution.

  • 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-25T12:01:20+00:00Added an answer on May 25, 2026 at 12:01 pm

    I’ve seen other questions that ask essentially the same question, and I believe it’s not really possible to do what you want effectively. My own opinion is it’s going to be a whole lot MORE work to make what you want than just to deploy SESSION:

    <?php
    
    session_start();
    
    if (!is_array($_SESSION['posted'])) {
        $_SESSION['posted'] = array('test'=>'test');
    } else {
        $_POST = $_SESSION['posted'];
        unset($_SESSION['posted']);
    }
    
    echo '<pre>';
    echo "<strong>POST:</strong>\n";
    print_r($_POST);
    echo "\n";
    echo "<strong>SESSION:</strong>\n";
    print_r($_SESSION);
    
    ?>
    

    * Note: I don’t have SSL setup on my server, so I can’t demonstrate that specifically. This is meant to demonstrate reinflating a POST array only from a SESSION-stored array.

    http://jfcoder.com/test/postsession.php (Refresh to see it change.)

    So if you can rebuild a POST array so easily^, why not just do that? The resources needed to do it across requests that are needed and actually used I believe will be negligible, since you’re really only doing it for a moment.

    Unless you have hundreds of thousand or millions of concurrent hits, I can’t imagine the above being a problem resource wise. If it was, then just process it before redirecting. They’ve already sent the data in the clear at that point anyway.

    ^ Also, you will need to handle file uploads as well, if you need that.

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

Sidebar

Related Questions

My Apache server works fine without -DSSL, but does not start with SSL. This
How can I find out what caused equals() to return false? I'm not asking
First off, I'm not asking about how to generate documentation FROM PHP source. That's
I am trying to create a moderately complex web page. This is not something
This question is related to Java Refuses To Start - Could Not Resrve Enough
Some of our FogBugz users experience that the Screenshot tool does not start-up automatically
I cannot connect to the SQL Server instance if I do not start management
I'm embarrassed to ask such a simple question. My term does not start for
I start GVIM in not-maximized window mode and split its window horizontally making sure
I ask this not to start anything negative. Rather, after looking at ASP.NET MVC

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.