Jump to content


Form Help


4 replies to this topic

#1 crushed

    Young Padawan

  • Members
  • Pip
  • 30 posts

Posted 04 May 2005 - 08:32 PM

This should be easy..I have some code..its great..except for..IT WON'T MAKE SURE THAT PASSWORDS AND EMAILS MATCH! I DON'T KNOW WHY! It's making me pretty frustrated..I can't think straight..here's my code..you can find it here

index.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Virtue Skate - Site Sign-up</title>
<meta name="description" content="Virtue Skate.">
<meta name="keywords" content="Virtue, Skate">
<link rel="stylesheet" type="text/css" href="/stylesheets/stylesheet.css">
</head>

<body><div align="center">
<!-- notice --!>
<br>To be a site customer, please fill out the short form below with your service needs.<br>
All fields marked with a <font color="#FF0000">*</font> are required.<br><br>
<fieldset><legend>Sign-up</legend>
<form enctype="multipart/form-data" action="orderprocess.php" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
<!-- first name --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>First Name:</td>
    <td align="left" width="55%" height="0" valign="center">
<input type="text" name="FirstName"></td>
  </tr>
  <tr>
<!-- last name --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Last Name:</td>
    <td align="left" width="55%" height="0" valign="center">
<input type="text" name="LastName"></td>
  </tr>
  <tr>
<!-- username --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Username:</td>
    <td align="left" width="55%" height="0" valign="center">
<input type="text" name="Username"></td>

  </tr>
  <tr>
<!-- password --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Password:</td>
    <td align="left" width="55%" height="0" valign="center">
<input type="password" name="Password"></td>
  </tr>
  <tr>
<!-- confirm password --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Confirm Password:</td>
    <td align="left" width="55%" height="0" valign="center">
<input type="password" name="ConfirmPassword"></td>
  </tr>
  <tr>
<!-- e-mail --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>E-mail:</td>
    <td align="left" width="55%" height="0" valign="center">
<input type="text" name="Email"></td>
  </tr>
  <tr>
<!-- confirm e-mail --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Confirm E-mail:</td>
    <td align="left" width="55%" height="0" valign="center">
<input type="text" name="ConfirmEmail"></td>
  </tr>
  <tr>
<!-- spacing --!>
    <td align="right" width="45%" height="0" valign="center">
<br><br></td>
    <td align="left" width="55%" height="0" valign="center">
<br><br></td>
  </tr>
  <tr>
<!-- hosting package --!>
    <td align="right" width="45%" height="0" valign="top">
<font color='#ff0000'>*</font>Hosting Package:</td>
    <td align="left" width="55%" height="0" valign="top">
<select name="HostingPackage"><option value="">Select HP<option value="HP 1">HP 1<option value="HP 2">HP 2</select></td>
  </tr>
  <tr>
<!-- site package --!>
    <td align="right" width="45%" height="0" valign="top">
<font color='#ff0000'>*</font>Site Package:</td>
    <td align="left" width="55%" height="0" valign="top">
<select name="SitePackage"><option value="">Select SP<option value="SP 1">SP 1<option value="SP 2">SP 2<option value="SP 3">SP 3<option value="SP 4">SP 4</select></td>
  </tr>
  <tr>
<!-- additional comments --!>
    <td align="right" width="45%" height="0" valign="center">
Additional Comments:</td>
    <td align="left" width="55%" height="0" valign="center"><textarea name="AdditionalComments" rows="5"

cols="40"></textarea></td>
  </tr>
  <tr>

<!-- submit --!>
    <td align="right" width="45%" height="0" valign="center">
&nbsp;</td>
    <td align="left" width="55%" height="0" valign="center">
<input type="submit" name="OrderProcess" value="Send"></td>
  </tr></table></form></fieldset></div>

</body>
</html>

orderprocess.php

<?PHP
 if($OrderProcess){
 $errors=0;
 $error="The following errors occured while processing your form input.<ul>";
 $FirstName=$_POST['FirstName'];
 $LastName=$_POST['LastName'];
 $Username=$_POST['Username'];
 $Password=$_POST['Password'];
 $ConfirmPassword=$_POST['ConfirmPassword'];
 $Email=$_POST['Email'];
 $ConfirmEmail=$_POST['ConfirmEmail'];
 $HostingPackage=$_POST['HostingPackage'];
 $SitePackage=$_POST['SitePackage'];
 $AdditionalComments=$_POST['AdditionalComments'];
 $AdditionalComments=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $AdditionalComments);
 if($FirstName== ""){
 $errors=1;
 $error.="<li><b>Your first name</b> is required. Please try again.<br>";}
 if($LastName== ""){
 $errors=1;
 $error.="<li><b>Your last name</b> is required. Please try again.<br>";
 }
 if($Username== ""){
 $errors=1;
 $error.="<li><b>Your desired username</b> is required. Please try again.<br>";
 }
 if($Password== ""){
 $errors=1;
 $error.="<li><b>Your desired password</b> is required. Please try again.<br>";
 }
 if($ConfirmPassword== ""){
 $errors=1;
 $error.="<li><b>Your confirmed password</b> is required. Please try again.<br>";
 }
 if($Password != $ConfirmPassword) {
  $error=1;
  $error.="<li><b>Your passwords</b> did not match. Please try again.";
 }
 if($Email== ""){
 $errors=1;
 $error.="<li><b>Your email</b> is required. Please try again.<br>";
 }
 if($ConfirmEmail== ""){
 $errors=1;
 $error.="<li><b>Your confirmed email</b> is required. Please try again.<br>";
 }
 if($Email != $ConfirmEmail) {
  $error=1;
  $error.="<li><b>Your emails</b> did not match. Please try again.";
 }
 if($HostingPackage== ""){
 $errors=1;
 $error.="<li><b>Your desired hosting package</b> is required. Please try again.<br>";
 }
 if($SitePackage== ""){
 $errors=1;
 $error.="<li><b>Your desired site package</b> is required. Please try again.<br>";
 }
 if($errors==1) {
 echo $error;
 }
 else{
 $message .= "Form: Sign-Up\n";
while (list ($key, $val) = each ($_POST)){
 if ($key != "OrderProcess"){
 if ($val != ""){
 $val = stripslashes($val);
 $message .= "$key: $val\n";
}
}
}
 $message = stripslashes($message);
 $message .= "$upload\n";
 $messageb .= "$message\n\n\n $_SERVER[HTTP_REFERER]";
mail("crushed@virtueskate.com","Form Sign-Up",$messageb,"From: crushed@virtueskate.com");
 if($errors==0) {
 $html=<<<HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Virtue Skate - Order Processed</title>
<meta name="description" content="Virtue Skate.">
<meta name="keywords" content="Virtue, Skate">
<link rel="stylesheet" type="text/css" href="/stylesheets/stylesheet.css">
</head>

<body><div align="center">
<!-- notice --!>
<br>You have succesfully processed your order. You will receive a reply email soon, from <b>crushed@virtueskate.com</b>.<br><br>
<fieldset><legend>Order Processed</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
  <tr>
<!-- first name --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>First Name:</td>
    <td align="left" width="55%" height="0" valign="center">
$FirstName</td>
  </tr>
  <tr>
<!-- last name --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Last Name:</td>
    <td align="left" width="55%" height="0" valign="center">
$LastName</td>
  </tr>
  <tr>
<!-- username --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Username:</td>
    <td align="left" width="55%" height="0" valign="center">
$Username</td>

  </tr>
  <tr>
<!-- password --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Password:</td>
    <td align="left" width="55%" height="0" valign="center">
$Password</td>
  </tr>
  <tr>
<!-- confirm password --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Confirm Password:</td>
    <td align="left" width="55%" height="0" valign="center">
Password matched.</td>
  </tr>
  <tr>
<!-- e-mail --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>E-mail:</td>
    <td align="left" width="55%" height="0" valign="center">
$Email</td>
  </tr>
  <tr>
<!-- confirm e-mail --!>
    <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Confirm E-mail:</td>
    <td align="left" width="55%" height="0" valign="center">
Email matched.</td>
  </tr>
  <tr>
<!-- spacing --!>
    <td align="right" width="45%" height="0" valign="center">
<br><br></td>
    <td align="left" width="55%" height="0" valign="center">
<br><br></td>
  </tr>
  <tr>
<!-- hosting package --!>
    <td align="right" width="45%" height="0" valign="top">
<font color='#ff0000'>*</font>Hosting Package:</td>
    <td align="left" width="55%" height="0" valign="top">
$HostingPackage</td>
  </tr>
  <tr>
<!-- site package --!>
    <td align="right" width="45%" height="0" valign="top">
<font color='#ff0000'>*</font>Site Package:</td>
    <td align="left" width="55%" height="0" valign="top">
$SitePackage</td>
  </tr>
  <tr>
<!-- additional comments --!>
    <td align="right" width="45%" height="0" valign="center">
Additional Comments:</td>
    <td align="left" width="55%" height="0" valign="center">
$AdditionalComments    </td>
  </tr>
  <tr>
    <td align="right" width="45%" height="0" valign="center">
<br><br></td>
    <td align="left" width="55%" height="0" valign="center">
<br><br></td>
  </tr>
    <td align="right" width="45%" height="0" valign="center">
&nbsp;</td>
    <td align="left" width="55%" height="0" valign="center">
Your order was <b>received</b>.</td>
  </tr></table></form></fieldset></div>

</body>
</html>
HTML;
 echo $html;
}
}
}
 ?>

Why won't the checkers work? In orderprocess.php? The variables are defined when submit is hit, and .. I don't see how it doesn't work. Help would be MUCH appreciated.

#2 MillerTime

    Young Padawan

  • Members
  • Pip
  • 69 posts

Posted 04 May 2005 - 11:36 PM

try getting rid of
$errors = 0;

in the beginning

actually try this,

<?PHP
if($OrderProcess){
$error="The following errors occured while processing your form input.<ul>";
$FirstName=$_POST['FirstName'];
$LastName=$_POST['LastName'];
$Username=$_POST['Username'];
$Password=$_POST['Password'];
$ConfirmPassword=$_POST['ConfirmPassword'];
$Email=$_POST['Email'];
$ConfirmEmail=$_POST['ConfirmEmail'];
$HostingPackage=$_POST['HostingPackage'];
$SitePackage=$_POST['SitePackage'];
$AdditionalComments=$_POST['AdditionalComments'];
$AdditionalComments=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $AdditionalComments);
if($FirstName== ""){
$errors=1;
$error.="<li><b>Your first name</b> is required. Please try again.<br>";}
else if($LastName== ""){
$errors=1;
$error.="<li><b>Your last name</b> is required. Please try again.<br>";
}
else if($Username== ""){
$errors=1;
$error.="<li><b>Your desired username</b> is required. Please try again.<br>";
}
else if($Password== ""){
$errors=1;
$error.="<li><b>Your desired password</b> is required. Please try again.<br>";
}
else if($ConfirmPassword== ""){
$errors=1;
$error.="<li><b>Your confirmed password</b> is required. Please try again.<br>";
}
else if($Password != $ConfirmPassword) {
 $error=1;
 $error.="<li><b>Your passwords</b> did not match. Please try again.";
}
else if($Email== ""){
$errors=1;
$error.="<li><b>Your email</b> is required. Please try again.<br>";
}
else if($ConfirmEmail== ""){
$errors=1;
$error.="<li><b>Your confirmed email</b> is required. Please try again.<br>";
}
else if($Email != $ConfirmEmail) {
 $error=1;
 $error.="<li><b>Your emails</b> did not match. Please try again.";
}
else if($HostingPackage== ""){
$errors=1;
$error.="<li><b>Your desired hosting package</b> is required. Please try again.<br>";
}
else if($SitePackage== ""){
$errors=1;
$error.="<li><b>Your desired site package</b> is required. Please try again.<br>";
}
else
{
$errors=0;
}
if($errors==1) {
echo $error;
}
else{
$message .= "Form: Sign-Up\n";
while (list ($key, $val) = each ($_POST)){
if ($key != "OrderProcess"){
if ($val != ""){
$val = stripslashes($val);
$message .= "$key: $val\n";
}
}
}
$message = stripslashes($message);
$message .= "$upload\n";
$messageb .= "$message\n\n\n $_SERVER[HTTP_REFERER]";
mail("crushed@virtueskate.com","Form Sign-Up",$messageb,"From: crushed@virtueskate.com");
if($errors==0) {
$html=<<<HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Virtue Skate - Order Processed</title>
<meta name="description" content="Virtue Skate.">
<meta name="keywords" content="Virtue, Skate">
<link rel="stylesheet" type="text/css" href="/stylesheets/stylesheet.css">
</head>

<body><div align="center">
<!-- notice --!>
<br>You have succesfully processed your order. You will receive a reply email soon, from <b>crushed@virtueskate.com</b>.<br><br>
<fieldset><legend>Order Processed</legend>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
 <tr>
<!-- first name --!>
   <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>First Name:</td>
   <td align="left" width="55%" height="0" valign="center">
$FirstName</td>
 </tr>
 <tr>
<!-- last name --!>
   <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Last Name:</td>
   <td align="left" width="55%" height="0" valign="center">
$LastName</td>
 </tr>
 <tr>
<!-- username --!>
   <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Username:</td>
   <td align="left" width="55%" height="0" valign="center">
$Username</td>

 </tr>
 <tr>
<!-- password --!>
   <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Password:</td>
   <td align="left" width="55%" height="0" valign="center">
$Password</td>
 </tr>
 <tr>
<!-- confirm password --!>
   <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Confirm Password:</td>
   <td align="left" width="55%" height="0" valign="center">
Password matched.</td>
 </tr>
 <tr>
<!-- e-mail --!>
   <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>E-mail:</td>
   <td align="left" width="55%" height="0" valign="center">
$Email</td>
 </tr>
 <tr>
<!-- confirm e-mail --!>
   <td align="right" width="45%" height="0" valign="center">
<font color='#ff0000'>*</font>Confirm E-mail:</td>
   <td align="left" width="55%" height="0" valign="center">
Email matched.</td>
 </tr>
 <tr>
<!-- spacing --!>
   <td align="right" width="45%" height="0" valign="center">
<br><br></td>
   <td align="left" width="55%" height="0" valign="center">
<br><br></td>
 </tr>
 <tr>
<!-- hosting package --!>
   <td align="right" width="45%" height="0" valign="top">
<font color='#ff0000'>*</font>Hosting Package:</td>
   <td align="left" width="55%" height="0" valign="top">
$HostingPackage</td>
 </tr>
 <tr>
<!-- site package --!>
   <td align="right" width="45%" height="0" valign="top">
<font color='#ff0000'>*</font>Site Package:</td>
   <td align="left" width="55%" height="0" valign="top">
$SitePackage</td>
 </tr>
 <tr>
<!-- additional comments --!>
   <td align="right" width="45%" height="0" valign="center">
Additional Comments:</td>
   <td align="left" width="55%" height="0" valign="center">
$AdditionalComments    </td>
 </tr>
 <tr>
   <td align="right" width="45%" height="0" valign="center">
<br><br></td>
   <td align="left" width="55%" height="0" valign="center">
<br><br></td>
 </tr>
   <td align="right" width="45%" height="0" valign="center">
&nbsp;</td>
   <td align="left" width="55%" height="0" valign="center">
Your order was <b>received</b>.</td>
 </tr></table></form></fieldset></div>

</body>
</html>
HTML;
echo $html;
}
}
}
?>

try that..

#3 crushed

    Young Padawan

  • Members
  • Pip
  • 30 posts

Posted 05 May 2005 - 05:26 PM

Thanks a lot..but..it doesn't work..I typed in two different passwords, and low and behold..it doesn't work. Thanks though! your post was much appreciated. it showed me that some people out there actually care.

#4 crushed

    Young Padawan

  • Members
  • Pip
  • 30 posts

Posted 05 May 2005 - 06:13 PM

How does it not work...

#5 MillerTime

    Young Padawan

  • Members
  • Pip
  • 69 posts

Posted 06 May 2005 - 06:25 PM

still doesnt work?..

let me play around with it..and ill see what i come up with..

or if you want a better solution..go to

http://www.kryptek.org

they are teh 1337est





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users