Jump to content

pressing back or refresh button without losing form data URGENT!


Go to solution Solved by hitman47,

Recommended Posts

HALLO,

 

i have one major problem.

 

I have a page that submits data to another with post for example this:

 

 <form  id="form2"  method="post" action="articles.php" >
         <table id="table1"  class="adminformat" >
           <tr><td>  <br></br><td></tr>  
           <tr >  
              <td><strong>Category:</strong></td> <td class="spaceUnder"><select name="catid" >
                    <?php     
               $cat_array = get_categories();  
         
               foreach ($cat_array as $row)  {
                     echo '<option value="'. $row['catid'].'">' . $row['catname'].'</option>';
               }
               ?>
            </select> </td></tr>
           <tr>
             <td colspan="2"><strong>Title :</strong> </td></tr>
           <tr>
             <td colspan="2" class="spaceUnder"><input maxlength="300" class="inputglow" type="text" name="title"/></td></tr>
              <tr>
             <td colspan="2"><strong>Message :</strong> </td></tr>
           <tr>
             <td colspan="2"><textarea name="message">
        </textarea></td></tr>
             
             <td align="right" colspan="2">
             <input type="reset" class="button" value="Clear"/>
           <input type="submit" class="button" value="OK"/></td></tr>
                       </table>
             </form>

 

The data is send to articles.php. If user presses refresh or back button, an ERROR PAGE in the browser is shown or forms are empty. I know i have to store somehow my variables. I have many forms, so i am looking for the best an easyest way, because i have to fill in a lot of code in many pages.

 

Furthermore when i press back and forawrd again, the articles page cannot be shown. Instead teh browser shows a message that the page HAS EXPIRED! I am so freaked out.

 

Please help i am so stuch.URGENT!!!!!!!!!

Edited by hitman47

You should not rely on the browsers back button to allow users to re-edit forms. You should provide a way for the user to go back and edit the forms so they are pre populated with the data they entered, or if you want the user to go back a page, then provide a link/button to that page or you could redirect the user with header() for an automatic redirect.

 

If you need to clear a form you should use the forms reset button, not the browsers refresh button.

You haven't understand. I don't want them to reenter forms. After submit,  If the user  accidentaly presses mouse or browser back button, the forms are aempty. Then if he presses forward then there is a message that THE PAGE HAS EXPIRED! I can't see the page. It's a huge bug and very annoying!!!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.