Jump to content

[SOLVED] Keeping form variables when you click Back


chiefrokka

Recommended Posts

I have about 30 text fields... upon testing them when they click Submit, I want them to go back and fix the error.  Every time I click Back though the fields are gone and they all have to be entered again.  very unfriendly. 

 

I'm gathering I could make a link they click to go back and pass all 30 text fields with the variables i got from _Post... but is there an easier way than doing index.php?var1=$var1&var2=$var2, etc. (because that would be very tedious)

 

 

Link to comment
Share on other sites

dont force users to press Back if there is an error, perhaps one of my biggest pet peeves about form registrations online.  The easiest way to fix this would be to submit the form to the same page for processing.  If there is an error, just output the form again with all of the (correct) values already inputted and error messages near the incorrect ones

Link to comment
Share on other sites

dont force users to press Back if there is an error, perhaps one of my biggest pet peeves about form registrations online.  The easiest way to fix this would be to submit the form to the same page for processing.  If there is an error, just output the form again with all of the (correct) values already inputted and error messages near the incorrect ones

that's what I'm trying to do, just trying to find the easiest code to do this.  I usually submit to same page and test if they clicked Submit.  If they did, i run the code and display succes/error messages.. if they didn't, i display form. 

 

I could use sessions I suppose

Link to comment
Share on other sites

If they DIDN'T click Submit, I grab all the values from database that they already set and my form displays the $row['var1'], $row['var2'] etc.

 

I guess I could just copy and paste the whole form and change all those initial values to be $_POST['var1'], $_POST['var2'] ??

Link to comment
Share on other sites

there is nothing to copy and paste, just use the same exact form with conditionals to display the data only if this is part of the submission process.

 

<input type='text' name='persons_Name' <?php if($submit) { echo "value=\"$_POST['persons_Name']\""; } ?> >

Link to comment
Share on other sites

there is nothing to copy and paste, just use the same exact form with conditionals to display the data only if this is part of the submission process.

 

<input type='text' name='persons_Name' <?php if($submit) { echo "value=\"$_POST['persons_Name']\""; } ?> >

 

I suppose that would be easiest. and just put an else in there to display db values instead if they didn't click submit.  thanks

Link to comment
Share on other sites

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.