php - $_POST to $_SESSION Issues -


i'm having trouble getting larger function post form details in browsers other chrome. i've narrowed problem down post, redirect, section of code.

i have recreated problem small function contains form , prg statement:

function testform(){      session_start();     error_reporting(e_all); ini_set('display_errors',1);      if(count($_post) > 0) {         $_session['testformtext'] = $_post['testformtext'];              if(isset($_post['testsubmit'])){         $_session['testsubmit'] = 1;}          header("http/1.1 303 see other");         header("location: https://$_server[http_host]/test-form/");         die();     }     elseif (isset($_session['testformtext'])){         $text = $_session['testformtext'];          $submit = $_session['testsubmit'];          /*             put database-affecting code here.         */           session_unset();         session_destroy();     }else{         $text = null;         }       echo '<div class="testform">         <form method="post" action="">             <input type="text" name="testformtext"/>             <input type="submit" name="testsubmit" value="submit">         </form>     </div>     ';         echo $text; } 

the function works correctly in chrome. enter input , submit form. data sent $_post set session variable. if session set, echoed variable $text after page redirected submitting form.

this not work firefox , safari. if can suggest how correctly set $_post session appreciated.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -