Jump to content

PaulM9

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

PaulM9's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello Everyone, Looking for some help with a form losing user input when clicking the browser back button. I have the code working perfectly when people register (ie if they forget to complete a field, they are kicked back to the form, and their other input is still there), however once a user logs into the site and wants to create a MySQL record using another form, if they leave a field empty and they get kicked back to fill in the blank field, all their other inputs are gone and they have to start filling the entire form again. I use the same logic for both, but one does not work. Any clues as to what could be wrong in the second scenario? if ($action=="add") { $dberror = ""; //add slashes to input so things don't get messed up in mySQL $city = addslashes($city); // check for blank fields if ($title == "") {die ("<P>Please select a title!<P><FORM><INPUT TYPE=\"BUTTON\" VALUE=\"BACK\" onClick=\"history.back()\"></FORM>");} elseif ($city == "") {die ("<P>Please enter your city / town!<P><FORM><INPUT TYPE=\"BUTTON\" VALUE=\"BACK\" onClick=\"history.back()\"></FORM>");} elseif ($state == "") {die ("<P>Please select your country!<P><FORM><INPUT TYPE=\"BUTTON\" VALUE=\"BACK\" onClick=\"history.back()\"></FORM>");} else //success! Go ahead and enter the record Then the record gets added to the MySQL database fine, no issues here. Further down the code is the input section, and I use this method: print "<form name=\"addlisting\" action=\"./agentadmin.php?action=add\" method=post>"; ….code for date entry here – standard stuff. print "<input type=submit value=\"Submit\"></form>"; Thank you, Paul.
×
×
  • 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.