Jump to content


Photo

Need some help.


  • Please log in to reply
5 replies to this topic

#1 esahp

esahp
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationUSA

Posted 20 September 2006 - 03:33 AM

I have a form setup, and after the user hits send it will go to another php page for processing using POST. This seems to work fine, until I get to the second page and hit back to the form, then it seems to desync or something? Then I'll change some stuff to test it and along with displaying the messages that something is wrong, it also displays the message Works, all clear.. Is there a way to stop this from happening?
<?
  $firstname = $_POST['firstname'];
  $lastname = $_POST['lastname'];
  $email = $_POST['email'];
  $phonenumber = $_POST['phonenumber'];
  $homeaddress = $_POST['homeaddress'];
  $citystate = $_POST['citystate'];
  $country = $_POST['country'];
  $domainname = $_POST['domainname'];
  $username = $_POST['username'];
  $password1 = $_POST['password1'];
  $password2 = $_POST['password2'];
  $rules = $_POST['rules'];
  $legalinfo = $_POST['legalinfo'];
  $age = $_POST['age'];
  $sitedetails = $_POST['sitedetails'];
  $aboutus = $_POST['aboutus'];
  if ($firstname == "") { echo "First Name field was left blank.<br />"; }
  if ($lastname == "") { echo "Last Name field was left blank.<br />"; }
  if ($email == "") { echo "Email Address field was left blank.<br />"; }
  if ($phonenumber == "") { echo "Phone Number field was left blank.<br />"; }
  if ($homeaddress == "") { echo "Home Address Field was left blank.<br />"; }
  if ($citystate == "") { echo "City&State field was left blank.<br />"; }
  if ($country == "") { echo "Country field was left blank.<br />"; }
  if ($domainname == "") { echo "Your Domain field was left blank.<br />"; }
  if ($username == "") { echo "Desired Username field was left blank.<br />"; }
  if (($password1 == "") || ($password2 == "") || ($password1 != $password2)) { echo "Password fields were left blank or do not match.<br />"; }
  if ($rules == "") { echo "You didn't agree to the rules.<br />"; }
  if ($legalinfo == "") { echo "You didnt agree to the legal information.<br />"; }
  if ($age == "") { echo "You didnt state you were over the age of 18.<br />"; }
  if ($sitedetails == "") { echo "Site Details field was left blank.<br />"; }
  if ($aboutus == "") { echo "About Us field was left blank.<br />"; }
  else {
    echo "Works, all clear.";
  }
?>

To obtain peace and quiet, get a Phoneless Cord.


#2 btherl

btherl
  • Staff Alumni
  • Advanced Member
  • 3,893 posts
  • LocationAustralia

Posted 20 September 2006 - 03:35 AM

What do you mean by "hit back to the form"?  And what does it look like when it desyncs?

#3 esahp

esahp
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationUSA

Posted 20 September 2006 - 03:40 AM

1. I fill in the info so it will come up with 'Works all clear!'
2. I hit send
3. I am taken to the processing page and see the message 'Works, all clear.'.
4. I hit the Back button on my browser (firefox).
5. I uncheck the rules checkbox
<input type="checkbox" name="rules" value="rules"> I agree with the rules.<br />
6. I am now greeted on the processing page with:

You didn't agree to the rules.
Works, all clear.


Tried to make that as simple as possible..

To obtain peace and quiet, get a Phoneless Cord.


#4 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 20 September 2006 - 04:29 AM

idk try :

<?

  $firstname = $_POST['firstname'];
  $lastname = $_POST['lastname'];
  $email = $_POST['email'];
  $phonenumber = $_POST['phonenumber'];
  $homeaddress = $_POST['homeaddress'];
  $citystate = $_POST['citystate'];
  $country = $_POST['country'];
  $domainname = $_POST['domainname'];
  $username = $_POST['username'];
  $password1 = $_POST['password1'];
  $password2 = $_POST['password2'];
  $rules = $_POST['rules'];
  $legalinfo = $_POST['legalinfo'];
  $age = $_POST['age'];
  $sitedetails = $_POST['sitedetails'];
  $aboutus = $_POST['aboutus'];
  if ($firstname == "") { echo "First Name field was left blank.<br />"; error = 1}
  if ($lastname == "") { echo "Last Name field was left blank.<br />"; error = 1}
  if ($email == "") { echo "Email Address field was left blank.<br />"; error = 1}
  if ($phonenumber == "") { echo "Phone Number field was left blank.<br />"; error = 1}
  if ($homeaddress == "") { echo "Home Address Field was left blank.<br />"; error = 1}
  if ($citystate == "") { echo "City&State field was left blank.<br />"; error = 1}
  if ($country == "") { echo "Country field was left blank.<br />"; error = 1}
  if ($domainname == "") { echo "Your Domain field was left blank.<br />"; error = 1}
  if ($username == "") { echo "Desired Username field was left blank.<br />"; error = 1}
  if (($password1 == "") || ($password2 == "") || ($password1 != $password2)) { echo "Password fields were left blank or do not match.<br />"; error = 1}
  if ($rules == "") { echo "You didn't agree to the rules.<br />"; error = 1}
  if ($legalinfo == "") { echo "You didnt agree to the legal information.<br />"; error = 1}
  if ($age == "") { echo "You didnt state you were over the age of 18.<br />"; error = 1}
  if ($sitedetails == "") { echo "Site Details field was left blank.<br />"; error = 1}
  if ($aboutus == "") { echo "About Us field was left blank.<br />"; error = 1}
  if error = "" {
    echo "Works, all clear.";
  }
?>

my guess would be that when u said else it was only refering to the $aboutus string...

#5 esahp

esahp
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationUSA

Posted 20 September 2006 - 04:49 AM

I did some more poking around and came up with this solution, almost similar to yours (which gave me an error by the way):
<?
  $firstname = $_POST['firstname'];
  $lastname = $_POST['lastname'];
  $email = $_POST['email'];
  $phonenumber = $_POST['phonenumber'];
  $homeaddress = $_POST['homeaddress'];
  $citystate = $_POST['citystate'];
  $country = $_POST['country'];
  $domainname = $_POST['domainname'];
  $username = $_POST['username'];
  $password1 = $_POST['password1'];
  $password2 = $_POST['password2'];
  $rules = $_POST['rules'];
  $legalinfo = $_POST['legalinfo'];
  $age = $_POST['age'];
  $sitedetails = $_POST['sitedetails'];
  $aboutus = $_POST['aboutus'];
  if ($firstname == "") { $errors .= "First Name field was left blank.<br />"; }
  if ($lastname == "") { $errors .= "Last Name field was left blank.<br />"; }
  if ($email == "") { $errors .= "Email Address field was left blank.<br />"; }
  if ($phonenumber == "") { $errors .= "Phone Number field was left blank.<br />"; }
  if ($homeaddress == "") { $errors .= "Home Address Field was left blank.<br />"; }
  if ($citystate == "") { $errors .= "City&State field was left blank.<br />"; }
  if ($country == "") { $errors .= "Country field was left blank.<br />"; }
  if ($domainname == "") { $errors .= "Your Domain field was left blank.<br />"; }
  if ($username == "") { $errors .= "Desired Username field was left blank.<br />"; }
  if (($password1 == "") || ($password2 == "") || ($password1 != $password2)) { $errors .= "Password fields were left blank or do not match.<br />"; }
  if ($rules == "") { $errors .= "You didn't agree to the rules.<br />"; }
  if ($legalinfo == "") { $errors .= "You didnt agree to the legal information.<br />"; }
  if ($age == "") { $errors .= "You didnt state you were over the age of 18.<br />"; }
  if ($sitedetails == "") { $errors .= "Site Details field was left blank.<br />"; }
  if ($aboutus == "") { $errors .= "About Us field was left blank.<br />"; }
  if (!isset($errors)) { 
    echo "all clear";
  }
  else {
    echo $errors;
  }
?>

To obtain peace and quiet, get a Phoneless Cord.


#6 BillyBoB

BillyBoB
  • Members
  • PipPipPip
  • Advanced Member
  • 630 posts

Posted 20 September 2006 - 04:56 AM

yea same thing i just havnt been doing php for a while sorry
ive been doing vb




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users