Jump to content

pressing back or refresh button without losing form data URGENT!


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!!!!!!!!!

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!!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.