How to retain information from a form


Hey guys!

I am trying to figure out how to retain the form information when a page refreshes but it doesn't seem to work. I have set the form action towards another page though and use the following code:

<!DOCTYPE html>
   <title>  </title>
   <link rel="stylesheet" type="text/css" href="style.css">




   if(isset($_SESSION['u_uid'])) {
      header("Location: index.php?signup=mustlogoutfirst");
   } else {
      include 'includes/dbh.php';
      include_once 'header.php';


   <section class="main-container">
    <div class="main-wrapper">
      <form class="signup-form" action="includes/signup2.php" method="POST">
         <input type="text" name="first" placeholder="First Name" value="<?php if(isset($_SESSION['u_first'])) { echo $_SESSION['u_first'];}?>">
         <input type="text" name="last" placeholder="Last Name">
         <input type="text" name="email" placeholder="Email">
         <input type="text" name="uid" placeholder="User ID">
         <input type="password" name="pwd" placeholder="Password">
         <label>Basic Subscription Plan</label>
         <select name="freelesson">
            <option value="Primer Level">Primer Level: Free</option>
          <label>Premium Subscription Plan 1</label>
         <select name="subscriptionplan">
            <option value="">Choose Subscription Plan 1</option>
            <option value="None">None</option>
            <option value="Level 1">Level 1</option>
            <option value="Level 2">Level 2</option>
            <option value="Level 3">Level 3</option>
         <button type="submit" name="submit">Sign up</button>

Should I use session or post for the value output?


As previously mentioned, try error_reporting(), etc at the top of each page. When the script is clear of all the errors and warnings, post your revised script... preferably formatted to make it easier for users to understand.


That should be a clue...


But I can only get this to work if the information is sent to the same page. I just can't get it to work when I have forwarded action="another.php" for example...


Why not? What have you tried? What happened when you tried that?


I tried it but it didn't show the first name or last name but it did work when I set action = ""


Again, we can't help you if you don't post any code.


Show us the code for that page, as well as the code you have shown. There's no reason for it not to work, it's just spotting the mistake / typo.


Ok.. will get to it ASAP


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.