mikebyrne Posted March 3, 2008 Share Posted March 3, 2008 I've just created a registration page and now need to validate it ie No numbers in name field and valid email address check etc The code I have is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black">Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black">Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black">Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black_on">Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black">Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">REGISTER EMPLOYEE</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <form name="form1" method="post" action="signup_ac.php"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Name:</td> <td><input type="text" name="name" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address:</td> <td><input type="text" name="address" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address1:</td> <td><input type="text" name="address1" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address2:</td> <td><input type="text" name="address2" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address3:</td> <td><input type="text" name="address3" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Address4:</td> <td><input type="text" name="address4" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">County:</td> <td><input type="text" name="county" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Zip:</td> <td><input type="text" name="zip" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Telephone:</td> <td><input type="text" name="telephone" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Email:</td> <td><input type="text" name="email" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Username:</td> <td><input type="text" name="username" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Password:</td> <td><input type="password" name="password" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Insert record"></td> </tr> </table> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <!-- btm finish --> </div> </div> </body> </html> Any help would be great Quote Link to comment Share on other sites More sharing options...
kkeim Posted March 3, 2008 Share Posted March 3, 2008 You can use "ereg" PHP function. Find more details at http://in.php.net/manual/en/function.ereg.php Post if you need any help integrating the function. Quote Link to comment Share on other sites More sharing options...
cr-ispinternet Posted March 3, 2008 Share Posted March 3, 2008 Hi there, your reg page should look something liek this and you really shouldnt post twice about 1 thing they get narky when u start doing that keep to one thread and then people can follow whats been said already.... <? if($action == "signup") { $valid=1; if (($name == "")) { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "Your name seems to be mising?<br>"; } if (($address == "") or (strlen($address)<2)) { $valid=0; $style_address = "background-color:#FF5959"; $error_address = "There is a problem with the address field?<br>"; } if (($address1 == "") or (strlen($address1)<2)) { $valid=0; $style_address1 = "background-color:#FF5959"; $error_address1 = "There is a problem with the address 1 field?<br>"; } if (($address2 == "") or (strlen($address2)<2)) { $valid=0; $style_address2 = "background-color:#FF5959"; $error_address2 = "There is a problem with the address 2 field?<br>"; } if (($address3 == "") or (strlen($address3)<2)) { $valid=0; $style_address3 = "background-color:#FF5959"; $error_address3 = "There is a problem with the address 3 field?<br>"; } if (($county == "") or (strlen($county)<2)) { $valid=0; $style_county = "background-color:#FF5959"; $error_county = "The County field is blank?<br>"; } if (($zip == "") or (strlen($zip)<2)) { $valid=0; $style_zip = "background-color:#FF5959"; $error_zip = "Theres a problem with the zip code?<br>"; } if (!eregi("^[0-9]+",$telephone)) { $valid=0; $style_telephone = "background-color:#FF5959"; $error_telephone = "Theres a problem with the telephone number?<br>"; } if (!eregi("^[A-Za-z0-9.-]+",$email)) { $valid=0; $style_email = "background-color:#FF5959"; $error_email = "Theres a problem with the email address?<br>"; } if (($password == "") or (strlen($password)<7)) { $valid=0; $style_password = "background-color:#FF5959"; $error_password = "Theres a problems with your password?<br>"; } if ($valid==1) { // start of valid ok look include("ac_signup.php"); } } echo <<<END <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black"> Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black"> Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black"> Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black_on"> Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">REGISTER EMPLOYEE</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <form name="form" method="post" action="adminreg.php"> <table align="center" width="546"> <tr valign="baseline"> <td nowrap align="right" width="95">Name:</td> <td nowrap align="right"> <input type="text" name="name" value="$name" size="32"></td> <td width="269"><font color="#FF0000">$error_name</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address:</td> <td nowrap align="right"> <input type="text" name="address" value="$address" size="32"></td> <td width="269"><font color="#FF0000">$error_address</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address1:</td> <td nowrap align="right"> <input type="text" name="address1" value="$address1" size="32"></td> <td width="269"><font color="#FF0000">$error_address1</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address2:</td> <td nowrap align="right"> <input type="text" name="address2" value="$address2" size="32"></td> <td width="269"><font color="#FF0000">$error_address2</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address3:</td> <td nowrap align="right"> <input type="text" name="address3" value="$address3" size="32"></td> <td width="269"><font color="#FF0000">$error-Address3</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address4:</td> <td nowrap align="right"><input type="text" name="address4" value="" size="32"></td> <td width="269"> </td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">County:</td> <td nowrap align="right"> <input type="text" name="county" value="$county" size="32"></td> <td width="269"><font color="#FF0000">$error_county</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Zip:</td> <td nowrap align="right"> <input type="text" name="zip" value="$zip" size="32"></td> <td width="269"><font color="#FF0000">$error_zip</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Telephone:</td> <td nowrap align="right"> <input type="text" name="telephone" value="$telephone" size="32"></td> <td width="269"><font color="#FF0000">$error_telephone</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Email:</td> <td nowrap align="right"> <input type="text" name="email" value="$email" size="32"></td> <td width="269"><font color="#FF0000">$error_email</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Username:</td> <td nowrap align="right"> <input type="text" name="username" value="$username" size="32"></td> <td width="269"><font color="#FF0000">$error_username</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Password:</td> <td nowrap align="right"> <input type="password" name="password" value="$password" size="32"></td> <td width="269"><font color="#FF0000">$error_password</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95"> </td> <td nowrap align="right"> <input type=hidden name=action value="signup"> <input type="submit" value="Insert record" style="float: left"> </td> <td width="269"> </td> </tr> </table> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <!-- btm finish --> </div> </div> </body> </html> END; ?> All you need to do now is aort the insert page and that should be that please pay special attention to the following though if($action == "signup") { this has to match this... <input type=hidden name=action value="signup"> and you need to make sure that the page posts to itself so if the page is called adminreg.php you need to make sure that <form name="form" method="post" action="adminreg.php"> any questions let me know, havnt tested but think that should be ok Alan Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 4, 2008 Author Share Posted March 4, 2008 Ok my first page is called adminreg.php <?php if($action == "signup_ac") { $valid=1; if (($name == "")) { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "Your name seems to be mising?<br>"; } if (($address == "") or (strlen($address)<2)) { $valid=0; $style_address = "background-color:#FF5959"; $error_address = "There is a problem with the address field?<br>"; } if (($address1 == "") or (strlen($address1)<2)) { $valid=0; $style_address1 = "background-color:#FF5959"; $error_address1 = "There is a problem with the address 1 field?<br>"; } if (($address2 == "") or (strlen($address2)<2)) { $valid=0; $style_address2 = "background-color:#FF5959"; $error_address2 = "There is a problem with the address 2 field?<br>"; } if (($address3 == "") or (strlen($address3)<2)) { $valid=0; $style_address3 = "background-color:#FF5959"; $error_address3 = "There is a problem with the address 3 field?<br>"; } if (($address4 == "") or (strlen($address4)<2)) { $valid=0; $style_address4 = "background-color:#FF5959"; $error_address4 = "There is a problem with the address 4 field?<br>"; } if (($county == "") or (strlen($county)<2)) { $valid=0; $style_county = "background-color:#FF5959"; $error_county = "The County field is blank?<br>"; } if (($zip == "") or (strlen($zip)<2)) { $valid=0; $style_zip = "background-color:#FF5959"; $error_zip = "Theres a problem with the zip code?<br>"; } if (!eregi("^[0-9]+",$telephone)) { $valid=0; $style_telephone = "background-color:#FF5959"; $error_telephone = "Theres a problem with the telephone number?<br>"; } if (!eregi("^[A-Za-z0-9.-]+",$email)) { $valid=0; $style_email = "background-color:#FF5959"; $error_email = "Theres a problem with the email address?<br>"; } if (($password == "") or (strlen($password)<7)) { $valid=0; $style_password = "background-color:#FF5959"; $error_password = "Theres a problems with your password?<br>"; } $connection = mysql_connect("localhost","database","password"); $db = mysql_select_db( "database", $connection); $sql = "SELECT username FROM admins WHERE username ='$username'"; $result = mysql_query($sql); $num = mysql_numrows($result); if ($num == 1) { $valid=0; $error_username = "Username is already taken<br>"; $style_username = "background-color:#FF5959"; } if ($valid==1) { include("ac_signup.php"); } } echo <<<END <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black"> Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black"> Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black"> Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black_on"> Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">REGISTER EMPLOYEE</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <form name="form" method="post" action="signup_ac"> <table align="center" width="546"> <tr valign="baseline"> <td nowrap align="right" width="95">Name:</td> <td nowrap align="right"> <input name="name" size="32" style="font-size: 8pt; $style_name; float:left" value="$name"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_name</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address:</td> <td nowrap align="right"> <input name="address" size="32" style="font-size: 8pt; $style_address; float:left" value="$address"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address1:</td> <td nowrap align="right"> <input name="address1" size="32" style="font-size: 8pt; $style_address1; float:left" value="$address1"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address1</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address2:</td> <td nowrap align="right"> <input name="address2" size="32" style="font-size: 8pt; $style_address2; float:left" value="$address2"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address2</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address3:</td> <td nowrap align="right"> <input name="address3" size="32" style="font-size: 8pt; $style_address3; float:left" value="$address3"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address3</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address4:</td> <td nowrap align="right"> <input name="address4" size="32" style="font-size: 8pt; $style_address4; float:left" value="$address4"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address4</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">County:</td> <td nowrap align="right"> <input name="county" size="32" style="font-size: 8pt; $style_county; float:left" value="$county"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_county</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Zip:</td> <td nowrap align="right"> <input name="zip" size="32" style="font-size: 8pt; $style_zip; float:left" value="$zip"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_zip</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Telephone:</td> <td nowrap align="right"> <input name="telephone" size="32" style="font-size: 8pt; $style_telephone; float:left" value="$telephone"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_telephone</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Email:</td> <td nowrap align="right"> <input name="email" size="32" style="font-size: 8pt; $style_email; float:left" value="$email"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_email</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Username:</td> <td nowrap align="right"> <input name="username" size="32" style="font-size: 8pt; $style_username; float:left" value="$username"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_username</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Password:</td> <td nowrap align="right"> <input name="password" size="32" style="font-size: 8pt; $style_password; float:left" value="$password" type="password"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_password</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95"> </td> <td nowrap align="right"> <input type=hidden name=action value="signup_ac"> <input type="submit" value="Insert record" style="float: left"> </td> <td width="269"> </td> </tr> </table> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <!-- btm finish --> </div> </div> </body> </html> END; ?> This then sends to signup_ac.php (This just populates the database) <?php header("Location: adminreg.php"); include('adminconnect.php'); // table name $tbl_name="adminusers"; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password, usertype)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password' , 2)"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); ?> Still cant get the validation to take place Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 4, 2008 Author Share Posted March 4, 2008 adminreg.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black"> Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black"> Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black"> Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black_on"> Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">REGISTER EMPLOYEE</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <form name="form" method="post" action="signup_ac.php"> <table align="center" width="546"> <tr valign="baseline"> <td nowrap align="right" width="95">Name:</td> <td nowrap align="right"> <input name="name" size="32" style="font-size: 8pt; $style_name; float:left" value="$name"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_name</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address:</td> <td nowrap align="right"> <input name="address" size="32" style="font-size: 8pt; $style_address; float:left" value="$address"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address1:</td> <td nowrap align="right"> <input name="address1" size="32" style="font-size: 8pt; $style_address1; float:left" value="$address1"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address1</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address2:</td> <td nowrap align="right"> <input name="address2" size="32" style="font-size: 8pt; $style_address2; float:left" value="$address2"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address2</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address3:</td> <td nowrap align="right"> <input name="address3" size="32" style="font-size: 8pt; $style_address3; float:left" value="$address3"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address3</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address4:</td> <td nowrap align="right"> <input name="address4" size="32" style="font-size: 8pt; $style_address4; float:left" value="$address4"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address4</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">County:</td> <td nowrap align="right"> <input name="county" size="32" style="font-size: 8pt; $style_county; float:left" value="$county"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_county</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Zip:</td> <td nowrap align="right"> <input name="zip" size="32" style="font-size: 8pt; $style_zip; float:left" value="$zip"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_zip</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Telephone:</td> <td nowrap align="right"> <input name="telephone" size="32" style="font-size: 8pt; $style_telephone; float:left" value="$telephone"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_telephone</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Email:</td> <td nowrap align="right"> <input name="email" size="32" style="font-size: 8pt; $style_email; float:left" value="$email"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_email</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Username:</td> <td nowrap align="right"> <input name="username" size="32" style="font-size: 8pt; $style_username; float:left" value="$username"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_username</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Password:</td> <td nowrap align="right"> <input name="password" size="32" style="font-size: 8pt; $style_password; float:left" value="$password" type="password"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_password</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95"> </td> <td nowrap align="right"> <input type=hidden name=action value="signup_ac.php"> <input type="submit" value="Insert record" style="float: left"> </td> <td width="269"> </td> </tr> </table> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <!-- btm finish --> </div> </div> </body> </html> signup_ac.php <?php if($action == "signup_ac") { $valid=1; if (($name == "")) { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "Your name seems to be mising?<br>"; } if (($address == "") or (strlen($address)<2)) { $valid=0; $style_address = "background-color:#FF5959"; $error_address = "There is a problem with the address field?<br>"; } if (($address1 == "") or (strlen($address1)<2)) { $valid=0; $style_address1 = "background-color:#FF5959"; $error_address1 = "There is a problem with the address 1 field?<br>"; } if (($address2 == "") or (strlen($address2)<2)) { $valid=0; $style_address2 = "background-color:#FF5959"; $error_address2 = "There is a problem with the address 2 field?<br>"; } if (($address3 == "") or (strlen($address3)<2)) { $valid=0; $style_address3 = "background-color:#FF5959"; $error_address3 = "There is a problem with the address 3 field?<br>"; } if (($address4 == "") or (strlen($address4)<2)) { $valid=0; $style_address4 = "background-color:#FF5959"; $error_address4 = "There is a problem with the address 4 field?<br>"; } if (($county == "") or (strlen($county)<2)) { $valid=0; $style_county = "background-color:#FF5959"; $error_county = "The County field is blank?<br>"; } if (($zip == "") or (strlen($zip)<2)) { $valid=0; $style_zip = "background-color:#FF5959"; $error_zip = "Theres a problem with the zip code?<br>"; } if (!eregi("^[0-9]+",$telephone)) { $valid=0; $style_telephone = "background-color:#FF5959"; $error_telephone = "Theres a problem with the telephone number?<br>"; } if (!eregi("^[A-Za-z0-9.-]+",$email)) { $valid=0; $style_email = "background-color:#FF5959"; $error_email = "Theres a problem with the email address?<br>"; } if (($password == "") or (strlen($password)<7)) { $valid=0; $style_password = "background-color:#FF5959"; $error_password = "Theres a problems with your password?<br>"; } include('adminconnect.php'); $sql = "SELECT username FROM adminusers WHERE username ='$username'"; $result = mysql_query($sql); $num = mysql_numrows($result); if ($num == 1) { $valid=0; $error_username = "Username is already taken<br>"; $style_username = "background-color:#FF5959"; } if ($valid==1) { include("ac_signup.php"); } } echo <<<END header("Location: adminreg.php"); include('adminconnect.php'); // table name $tbl_name="adminusers"; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password, usertype)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password' , 2)"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); ?> The validation error report for each section now appears when the page loads!! Any idea where I'm going wrong here?? Quote Link to comment Share on other sites More sharing options...
cr-ispinternet Posted March 5, 2008 Share Posted March 5, 2008 Mike, Call the code im pasting below adminreg.php <?php if($action == "signup") { $valid=1; if (($name == "")) { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "Your name seems to be mising?<br>"; } if (($address == "") or (strlen($address)<2)) { $valid=0; $style_address = "background-color:#FF5959"; $error_address = "There is a problem with the address field?<br>"; } if (($address1 == "") or (strlen($address1)<2)) { $valid=0; $style_address1 = "background-color:#FF5959"; $error_address1 = "There is a problem with the address 1 field?<br>"; } if (($address2 == "") or (strlen($address2)<2)) { $valid=0; $style_address2 = "background-color:#FF5959"; $error_address2 = "There is a problem with the address 2 field?<br>"; } if (($address3 == "") or (strlen($address3)<2)) { $valid=0; $style_address3 = "background-color:#FF5959"; $error_address3 = "There is a problem with the address 3 field?<br>"; } if (($address4 == "") or (strlen($address4)<2)) { $valid=0; $style_address4 = "background-color:#FF5959"; $error_address4 = "There is a problem with the address 4 field?<br>"; } if (($county == "") or (strlen($county)<2)) { $valid=0; $style_county = "background-color:#FF5959"; $error_county = "The County field is blank?<br>"; } if (($zip == "") or (strlen($zip)<2)) { $valid=0; $style_zip = "background-color:#FF5959"; $error_zip = "Theres a problem with the zip code?<br>"; } if (!eregi("^[0-9]+",$telephone)) { $valid=0; $style_telephone = "background-color:#FF5959"; $error_telephone = "Theres a problem with the telephone number?<br>"; } if (!eregi("^[A-Za-z0-9.-]+",$email)) { $valid=0; $style_email = "background-color:#FF5959"; $error_email = "Theres a problem with the email address?<br>"; } if (($password == "") or (strlen($password)<7)) { $valid=0; $style_password = "background-color:#FF5959"; $error_password = "Theres a problems with your password?<br>"; } $connection = mysql_connect("localhost","database","password"); $db = mysql_select_db( "database", $connection); $sql = "SELECT username FROM admins WHERE username ='$username'"; $result = mysql_query($sql); $num = mysql_numrows($result); if ($num == 1) { $valid=0; $error_username = "Username is already taken<br>"; $style_username = "background-color:#FF5959"; } if ($valid==1) { include("ac_signup.php"); } } echo <<<END <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black"> Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black"> Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black"> Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black_on"> Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">REGISTER EMPLOYEE</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <form name="form" method="post" action="adminreg.php"> <table align="center" width="546"> <tr valign="baseline"> <td nowrap align="right" width="95">Name:</td> <td nowrap align="right"> <input name="name" size="32" style="font-size: 8pt; $style_name; float:left" value="$name"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_name</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address:</td> <td nowrap align="right"> <input name="address" size="32" style="font-size: 8pt; $style_address; float:left" value="$address"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address1:</td> <td nowrap align="right"> <input name="address1" size="32" style="font-size: 8pt; $style_address1; float:left" value="$address1"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address1</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address2:</td> <td nowrap align="right"> <input name="address2" size="32" style="font-size: 8pt; $style_address2; float:left" value="$address2"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address2</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address3:</td> <td nowrap align="right"> <input name="address3" size="32" style="font-size: 8pt; $style_address3; float:left" value="$address3"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address3</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address4:</td> <td nowrap align="right"> <input name="address4" size="32" style="font-size: 8pt; $style_address4; float:left" value="$address4"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address4</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">County:</td> <td nowrap align="right"> <input name="county" size="32" style="font-size: 8pt; $style_county; float:left" value="$county"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_county</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Zip:</td> <td nowrap align="right"> <input name="zip" size="32" style="font-size: 8pt; $style_zip; float:left" value="$zip"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_zip</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Telephone:</td> <td nowrap align="right"> <input name="telephone" size="32" style="font-size: 8pt; $style_telephone; float:left" value="$telephone"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_telephone</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Email:</td> <td nowrap align="right"> <input name="email" size="32" style="font-size: 8pt; $style_email; float:left" value="$email"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_email</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Username:</td> <td nowrap align="right"> <input name="username" size="32" style="font-size: 8pt; $style_username; float:left" value="$username"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_username</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Password:</td> <td nowrap align="right"> <input name="password" size="32" style="font-size: 8pt; $style_password; float:left" value="$password" type="password"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_password</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95"> </td> <td nowrap align="right"> <input type=hidden name=action value="signup"> <input type="submit" value="Insert record" style="float: left"> </td> <td width="269"> </td> </tr> </table> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <!-- btm finish --> </div> </div> </body> </html> END; ?> and then call this one ac_signup.php <?php include('adminconnect.php'); // table name $tbl_name="adminusers"; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password, usertype)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password' , 2)"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); echo <<<END html code here to say your account has been added optional send email to confirm there addition END; ?> something like that, theres no reason why it cant or wont work Alan Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 5, 2008 Author Share Posted March 5, 2008 I've copied and pasted your code and renamed the files but it still wont validate. The form doesnt seem to pass to ac_signup.php adminreg.php looks like this: <?php if($action == "signup") { $valid=1; if (($name == "")) { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "Your name seems to be mising?<br>"; } if (($address == "") or (strlen($address)<2)) { $valid=0; $style_address = "background-color:#FF5959"; $error_address = "There is a problem with the address field?<br>"; } if (($address1 == "") or (strlen($address1)<2)) { $valid=0; $style_address1 = "background-color:#FF5959"; $error_address1 = "There is a problem with the address 1 field?<br>"; } if (($address2 == "") or (strlen($address2)<2)) { $valid=0; $style_address2 = "background-color:#FF5959"; $error_address2 = "There is a problem with the address 2 field?<br>"; } if (($address3 == "") or (strlen($address3)<2)) { $valid=0; $style_address3 = "background-color:#FF5959"; $error_address3 = "There is a problem with the address 3 field?<br>"; } if (($address4 == "") or (strlen($address4)<2)) { $valid=0; $style_address4 = "background-color:#FF5959"; $error_address4 = "There is a problem with the address 4 field?<br>"; } if (($county == "") or (strlen($county)<2)) { $valid=0; $style_county = "background-color:#FF5959"; $error_county = "The County field is blank?<br>"; } if (($zip == "") or (strlen($zip)<2)) { $valid=0; $style_zip = "background-color:#FF5959"; $error_zip = "Theres a problem with the zip code?<br>"; } if (!eregi("^[0-9]+",$telephone)) { $valid=0; $style_telephone = "background-color:#FF5959"; $error_telephone = "Theres a problem with the telephone number?<br>"; } if (!eregi("^[A-Za-z0-9.-]+",$email)) { $valid=0; $style_email = "background-color:#FF5959"; $error_email = "Theres a problem with the email address?<br>"; } if (($password == "") or (strlen($password)<7)) { $valid=0; $style_password = "background-color:#FF5959"; $error_password = "Theres a problems with your password?<br>"; } $connection = mysql_connect("localhost","database","password"); $db = mysql_select_db( "database", $connection); $sql = "SELECT username FROM admins WHERE username ='$username'"; $result = mysql_query($sql); $num = mysql_numrows($result); if ($num == 1) { $valid=0; $error_username = "Username is already taken<br>"; $style_username = "background-color:#FF5959"; } if ($valid==1) { include("ac_signup.php"); } } echo <<<END <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black"> Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black"> Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black"> Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black_on"> Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">REGISTER EMPLOYEE</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <form name="form" method="post" action="adminreg.php"> <table align="center" width="546"> <tr valign="baseline"> <td nowrap align="right" width="95">Name:</td> <td nowrap align="right"> <input name="name" size="32" style="font-size: 8pt; $style_name; float:left" value="$name"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_name</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address:</td> <td nowrap align="right"> <input name="address" size="32" style="font-size: 8pt; $style_address; float:left" value="$address"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address1:</td> <td nowrap align="right"> <input name="address1" size="32" style="font-size: 8pt; $style_address1; float:left" value="$address1"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address1</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address2:</td> <td nowrap align="right"> <input name="address2" size="32" style="font-size: 8pt; $style_address2; float:left" value="$address2"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address2</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address3:</td> <td nowrap align="right"> <input name="address3" size="32" style="font-size: 8pt; $style_address3; float:left" value="$address3"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address3</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address4:</td> <td nowrap align="right"> <input name="address4" size="32" style="font-size: 8pt; $style_address4; float:left" value="$address4"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address4</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">County:</td> <td nowrap align="right"> <input name="county" size="32" style="font-size: 8pt; $style_county; float:left" value="$county"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_county</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Zip:</td> <td nowrap align="right"> <input name="zip" size="32" style="font-size: 8pt; $style_zip; float:left" value="$zip"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_zip</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Telephone:</td> <td nowrap align="right"> <input name="telephone" size="32" style="font-size: 8pt; $style_telephone; float:left" value="$telephone"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_telephone</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Email:</td> <td nowrap align="right"> <input name="email" size="32" style="font-size: 8pt; $style_email; float:left" value="$email"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_email</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Username:</td> <td nowrap align="right"> <input name="username" size="32" style="font-size: 8pt; $style_username; float:left" value="$username"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_username</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Password:</td> <td nowrap align="right"> <input name="password" size="32" style="font-size: 8pt; $style_password; float:left" value="$password" type="password"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_password</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95"> </td> <td nowrap align="right"> <input type=hidden name=action value="signup"> <input type="submit" value="Insert record" style="float: left"> </td> <td width="269"> </td> </tr> </table> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <!-- btm finish --> </div> </div> </body> </html> END; ?> Quote Link to comment Share on other sites More sharing options...
blueman378 Posted March 5, 2008 Share Posted March 5, 2008 change <form name="form" method="post" action="adminreg.php"> to <form name="form" method="post" action="ac_signup.php"> Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 5, 2008 Author Share Posted March 5, 2008 That posts "html code here to say your account has been added optional send email to confirm there addition" on screen but the validation still doesnt seem to take place Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 5, 2008 Author Share Posted March 5, 2008 The code dosent seem to process the validation requests. CANT FIGURE OUT WHY???? Any help on this would be great Quote Link to comment Share on other sites More sharing options...
blueman378 Posted March 5, 2008 Share Posted March 5, 2008 so you get no errors come up from mysql? Quote Link to comment Share on other sites More sharing options...
blueman378 Posted March 5, 2008 Share Posted March 5, 2008 do you have this site uploaded somewhere so we can test it? Quote Link to comment Share on other sites More sharing options...
blueman378 Posted March 5, 2008 Share Posted March 5, 2008 call this page adminreg.php <?php echo <<<END <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> <link href="../Admin_files/admin.css" rel="stylesheet" type="text/css" /> <script type="text/JavaScript" src="../Admin_files/wrapper.js"></script> </head> <body> <div id="Box"> <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="../Admin_files/logo.gif" width="51" height="125" border="0" /></a></div> <div id="contentBox"> <!-- logo start --> <div id="container"> <div class="padTop28"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- logo finish --> <!-- menu start --> <div id="container"> <div id="menu1"> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/new.php" class="black"> Order</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../admin_files/sales.php" class="black"> Sales</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_on"><a href="../admin_files/list.php" class="black"> Edit item</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Postage fee</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_on"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black_on"> Add User</a></div> <div id="menu_space1"><!-- --></div> <div id="menu_off"><!-- --></div> <div id="menu_text_off"><a href="../shipping/current.php" class="black"> Add Product</a></div> <div id="menu_space1"><!-- --></div> </div> <div class="clr"><!-- --></div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="dotted"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div class="padTop5"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="menu2"> <div id="menu_hide"> <!-- --> </div> <div id="menu_text_off"> </div> <div id="menu_space1"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div class="padTop38"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- menu finish --> <!-- top start --> <div id="container"> <div id="line"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <div id="containerBg1"> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> <div id="titleText">REGISTER EMPLOYEE</div> <div class="clr"> <!-- --> </div> <div class="padTop15"> <!-- --> </div> <div class="clr"> <!-- --> </div> </div> <div class="clr"> <!-- --> </div> <!-- top finish --> <!-- data title start --> <div id="containerBg2"> <div class="padTop2"> <!-- --> </div> <div class="clr"> <!-- --> </div> <form name="form" method="post" action="adminreg.php"> <table align="center" width="546"> <tr valign="baseline"> <td nowrap align="right" width="95">Name:</td> <td nowrap align="right"> <input name="name" size="32" style="font-size: 8pt; $style_name; float:left" value="$name"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_name</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address:</td> <td nowrap align="right"> <input name="address" size="32" style="font-size: 8pt; $style_address; float:left" value="$address"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address1:</td> <td nowrap align="right"> <input name="address1" size="32" style="font-size: 8pt; $style_address1; float:left" value="$address1"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address1</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address2:</td> <td nowrap align="right"> <input name="address2" size="32" style="font-size: 8pt; $style_address2; float:left" value="$address2"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address2</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address3:</td> <td nowrap align="right"> <input name="address3" size="32" style="font-size: 8pt; $style_address3; float:left" value="$address3"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address3</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address4:</td> <td nowrap align="right"> <input name="address4" size="32" style="font-size: 8pt; $style_address4; float:left" value="$address4"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_address4</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">County:</td> <td nowrap align="right"> <input name="county" size="32" style="font-size: 8pt; $style_county; float:left" value="$county"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_county</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Zip:</td> <td nowrap align="right"> <input name="zip" size="32" style="font-size: 8pt; $style_zip; float:left" value="$zip"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_zip</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Telephone:</td> <td nowrap align="right"> <input name="telephone" size="32" style="font-size: 8pt; $style_telephone; float:left" value="$telephone"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_telephone</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Email:</td> <td nowrap align="right"> <input name="email" size="32" style="font-size: 8pt; $style_email; float:left" value="$email"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_email</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Username:</td> <td nowrap align="right"> <input name="username" size="32" style="font-size: 8pt; $style_username; float:left" value="$username"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_username</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Password:</td> <td nowrap align="right"> <input name="password" size="32" style="font-size: 8pt; $style_password; float:left" value="$password" type="password"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_password</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95"> </td> <td nowrap align="right"> <input type=hidden name=action value="signup"> <input type="submit" value="Insert record" style="float: left"> </td> <td width="269"> </td> </tr> </table> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <!-- btm finish --> </div> </div> </body> </html> END; ?> call this page ac_signup.php <?php include('adminconnect.php'); // table name $tbl_name="adminusers"; // values sent from form $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; if($action == "signup") { $valid=1; if (($name == "")) { $valid=0; $style_name = "background-color:#FF5959"; $error_name = "Your name seems to be mising?<br>"; } if (($address == "") or (strlen($address)<2)) { $valid=0; $style_address = "background-color:#FF5959"; $error_address = "There is a problem with the address field?<br>"; } if (($address1 == "") or (strlen($address1)<2)) { $valid=0; $style_address1 = "background-color:#FF5959"; $error_address1 = "There is a problem with the address 1 field?<br>"; } if (($address2 == "") or (strlen($address2)<2)) { $valid=0; $style_address2 = "background-color:#FF5959"; $error_address2 = "There is a problem with the address 2 field?<br>"; } if (($address3 == "") or (strlen($address3)<2)) { $valid=0; $style_address3 = "background-color:#FF5959"; $error_address3 = "There is a problem with the address 3 field?<br>"; } if (($address4 == "") or (strlen($address4)<2)) { $valid=0; $style_address4 = "background-color:#FF5959"; $error_address4 = "There is a problem with the address 4 field?<br>"; } if (($county == "") or (strlen($county)<2)) { $valid=0; $style_county = "background-color:#FF5959"; $error_county = "The County field is blank?<br>"; } if (($zip == "") or (strlen($zip)<2)) { $valid=0; $style_zip = "background-color:#FF5959"; $error_zip = "Theres a problem with the zip code?<br>"; } if (!eregi("^[0-9]+",$telephone)) { $valid=0; $style_telephone = "background-color:#FF5959"; $error_telephone = "Theres a problem with the telephone number?<br>"; } if (!eregi("^[A-Za-z0-9.-]+",$email)) { $valid=0; $style_email = "background-color:#FF5959"; $error_email = "Theres a problem with the email address?<br>"; } if (($password == "") or (strlen($password)<7)) { $valid=0; $style_password = "background-color:#FF5959"; $error_password = "Theres a problems with your password?<br>"; } $connection = mysql_connect("localhost","database","password"); $db = mysql_select_db( "database", $connection); $sql = "SELECT username FROM admins WHERE username ='$username'"; $result = mysql_query($sql); $num = mysql_numrows($result); if ($num == 1) { $valid=0; $error_username = "Username is already taken<br>"; $style_username = "background-color:#FF5959"; } if ($valid==1) { $sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password, usertype)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password' , 2)"; $result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql"); echo <<<END html code here to say your account has been added optional send email to confirm there addition END; } } ?> try that Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 5, 2008 Author Share Posted March 5, 2008 No, nothing happens with that code. Just seems to refresh page and doesnt validate Quote Link to comment Share on other sites More sharing options...
blueman378 Posted March 6, 2008 Share Posted March 6, 2008 so its not uploaded on the web anywhere? also is this posting the data to the mysql server? Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 6, 2008 Author Share Posted March 6, 2008 No its just running on the localhost on my laptop at present. It isnt posting to the database either. The SQL for the database is -- ---------------------------- -- Table structure for adminusers -- ---------------------------- CREATE TABLE `adminusers` ( `name` varchar(255) collate latin1_general_ci default NULL, `address` varchar(255) collate latin1_general_ci default NULL, `address1` varchar(255) collate latin1_general_ci default NULL, `address2` varchar(255) collate latin1_general_ci default NULL, `address3` varchar(255) collate latin1_general_ci default NULL, `address4` varchar(255) collate latin1_general_ci default NULL, `county` varchar(255) collate latin1_general_ci default NULL, `zip` varchar(255) collate latin1_general_ci default NULL, `telephone` decimal(10,0) default NULL, `email` varchar(255) collate latin1_general_ci default NULL, `username` varchar(255) collate latin1_general_ci default NULL, `password` varchar(255) collate latin1_general_ci default NULL, `usertype` decimal(10,0) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; -- ---------------------------- -- Records -- ---------------------------- INSERT INTO `adminusers` VALUES ('Michael', '', '', '', '', '', '', '', '0', '', '', '', null); INSERT INTO `adminusers` VALUES ('Michael', '', '', '', '', '', '', '', '0', '', '', '', null); INSERT INTO `adminusers` VALUES ('Michael', '', '', '', '', '', '', '', '0', '', '', '', null); INSERT INTO `adminusers` VALUES ('Test', 'yyy', 'yfgfg', 'tftrtrt', 'dtddtdtd', 'tdtdtdtd', 'tdtduhlllkk', 'oooioi', '787875675', 'hjhjhkhjkhjkh', 'jhjhjhkjh', '7676767678', null); INSERT INTO `adminusers` VALUES ('fkdjkfdjfkdjk', 'bvcfd', 'rdrer', 'etyr', 'ytuyi', 'uoiu', 'uiu', 'iu', '0', 'oiui', 'u', 'iuiuiuiuoiui', '2'); INSERT INTO `adminusers` VALUES ('', '', '', '', '', '', '', '', '0', '', '', '', '2'); INSERT INTO `adminusers` VALUES ('', '', '', '', '', '', '', '', '0', '', '', '', '2'); INSERT INTO `adminusers` VALUES ('Mike Byrne', '', '', '', '', '', '', '', '0', '', '', '', '2'); INSERT INTO `adminusers` VALUES ('Mike Byrne', '', '', '', '', '', '', '', '0', '', '', '', '2'); Quote Link to comment Share on other sites More sharing options...
Baabu Posted March 6, 2008 Share Posted March 6, 2008 just put ur database connection script at the start of file just after <? in the file i sent u my net is currently slow so cant send u email just put ur connection script after the php starts in adminreg.php the file i sent u Quote Link to comment Share on other sites More sharing options...
mikebyrne Posted March 6, 2008 Author Share Posted March 6, 2008 I've tried the following code but nothing seems to happen <?php include('adminconnect.php'); if($action == "signup") { $name=$_POST['name']; $address=$_POST['address']; $address1=$_POST['address1']; $address2=$_POST['address2']; $address3=$_POST['address3']; $address4=$_POST['address4']; $county=$_POST['county']; $zip=$_POST['zip']; $telephone=$_POST['telephone']; $email=$_POST['email']; $username=$_POST['username']; $password=$_POST['password']; echo $name."here"; $valid=1; if (($name == "")) { $valid=0; //echo "invalue"; $style_name = "background-color:#FF5959"; $error_name = "Your name seems to be mising?<br>"; } if (($address == "") or (strlen($address)<2)) { $valid=0; $style_address = "background-color:#FF5959"; $error_address = "There is a problem with the address field?<br>"; } if (($address1 == "") or (strlen($address1)<2)) { $valid=0; $style_address1 = "background-color:#FF5959"; $error_address1 = "There is a problem with the address 1 field?<br>"; } if (($address2 == "") or (strlen($address2)<2)) { $valid=0; $style_address2 = "background-color:#FF5959"; $error_address2 = "There is a problem with the address 2 field?<br>"; } if (($address3 == "") or (strlen($address3)<2)) { $valid=0; $style_address3 = "background-color:#FF5959"; $error_address3 = "There is a problem with the address 3 field?<br>"; } if (($address4 == "") or (strlen($address4)<2)) { $valid=0; $style_address4 = "background-color:#FF5959"; $error_address4 = "There is a problem with the address 4 field?<br>"; } if (($county == "") or (strlen($county)<2)) { $valid=0; $style_county = "background-color:#FF5959"; $error_county = "The County field is blank?<br>"; } if (($zip == "") or (strlen($zip)<2)) { $valid=0; $style_zip = "background-color:#FF5959"; $error_zip = "Theres a problem with the zip code?<br>"; } if (!eregi("^[0-9]+",$telephone)) { $valid=0; $style_telephone = "background-color:#FF5959"; $error_telephone = "Theres a problem with the telephone number?<br>"; } if (!eregi("^[A-Za-z0-9.-]+",$email)) { $valid=0; $style_email = "background-color:#FF5959"; $error_email = "Theres a problem with the email address?<br>"; } if (($password == "") or (strlen($password)<7)) { $valid=0; $style_password = "background-color:#FF5959"; $error_password = "Theres a problems with your password?<br>"; } $connection = mysql_connect("localhost","root","triadpass"); $db = mysql_select_db( "test", $connection); $sql = "SELECT username FROM admins WHERE username ='$username'"; $result = mysql_query($sql); $num = mysql_numrows($result); if ($num == 1) { $valid=0; $error_username = "Username is already taken<br>"; $style_username = "background-color:#FF5959"; } if ($valid==1) { include("ac_signup.php"); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>e-commerce admin page sample |item</title> </head> <body> <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table align="center" width="546"> <tr valign="baseline"> <td nowrap align="right" width="95">Name:</td> <td nowrap align="right"> <input name="name" size="32" style="font-size: 8pt; $style_name; float:left" value="<?php echo $name; ?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_name; ?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address:</td> <td nowrap align="right"> <input name="address" size="32" style="font-size: 8pt; $style_address; float:left" value="<?php echo $address; ?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_address; ?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address1:</td> <td nowrap align="right"> <input name="address1" size="32" style="font-size: 8pt; $style_address1; float:left" value="<?php echo $address1; ?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_address1; ?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address2:</td> <td nowrap align="right"> <input name="address2" size="32" style="font-size: 8pt; $style_address2; float:left" value="<?php echo $address2 ;?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_address2; ?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address3:</td> <td nowrap align="right"> <input name="address3" size="32" style="font-size: 8pt; $style_address3; float:left" value="<?php echo $address3; ?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_address3; ?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Address4:</td> <td nowrap align="right"> <input name="address4" size="32" style="font-size: 8pt; $style_address4; float:left" value="<?php $address4; ?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_address4;?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">County:</td> <td nowrap align="right"> <input name="county" size="32" style="font-size: 8pt; $style_county; float:left" value="<?php echo $county; ?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_county ?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Zip:</td> <td nowrap align="right"> <input name="zip" size="32" style="font-size: 8pt; $style_zip; float:left" value="<?php echo $zip; ?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_zip;?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Telephone:</td> <td nowrap align="right"> <input name="telephone" size="32" style="font-size: 8pt; $style_telephone; float:left" value="<?php $telephone; ?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt">$error_telephone</font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Email:</td> <td nowrap align="right"> <input name="email" size="32" style="font-size: 8pt; $style_email; float:left" value="<?php $email;?>"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_email;?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Username:</td> <td nowrap align="right"> <input name="username" size="32" style="font-size: 8pt; $style_username; float:left"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_username; ?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95">Password:</td> <td nowrap align="right"> <input name="password" size="32" style="font-size: 8pt; $style_password; float:left"type="password"></td> <td width="269"><font color="#FF0000" style="font-size: 8pt"><?php echo $error_password; ?></font></td> </tr> <tr valign="baseline"> <td nowrap align="right" width="95"> </td> <td nowrap align="right"> <input type=hidden name=action value="signup"> <input type="submit" value="Insert record" style="float: left"> </td> <td width="269"> </td> </tr> </table> </form> </div> <!-- btm start --> <div id="containerBg1"> <div class="padTop15"><!-- --></div> <div class="clr"><!-- --></div> </div> <div class="clr"><!-- --></div> <div id="container"> <div id="line"><!-- --></div> </div> <!-- btm finish --> </div> </div> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.