Keeping a PHP variable throughout several HTML pages/stages -


i'm getting variable $email undefined. know emailparser() method works it's supposed do.

how make variable $email persists can access in second iteration of index.php?

<?php if ($_server["request_method"] == "post") {     $message = $_post["message"];     include "etext.php";     //run etext      $email = emailparser($message); //set running etext       header("location: index.php?status=submitted");     exit; }  ?>  <h1>etext email converter</h1>  <?php if (isset($_get["status"]) , $_get["status"] == "submitted") {     $output_file_path = $email->generateparsedemailfile();   ?>     <p> file located at: <?php echo $output_file_path; ?> </p><br>     <a href=<?php echo $output_file_path;?> >click here access</a> <?php  } else { ?>     <form method="post" action="index.php">         <label for"message"></label>         <textarea rows="30" cols="40" name="message" id="message"></textarea>         <input type="submit" value="submit">      </form> <?php } ?> 

you can use $_session super-global achieve this.

$_session['email'] = 'example@example.com'; 

that make variable accessible on multiple pages provided support sessions within code.

to that, on every page want access session values call

session_start(); 

and after have called that, can go ahead , access variable set elsewhere.

echo $_session['email']; // outputs example@example.com 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -