Jump to content

Clear form after inserting records?


mikebyrne

Recommended Posts

At present my form puts all the info into the database after validation as it should but when the form is returned to screen

 

Name

Address

Address1

Address2

Address3

County

Zip

 

are still present and I cant figure out why these are showing and

 

Address4

Telephone

Username

Email

Passwod

 

return blank as I want?

 

my complete code is:

 

<?php
require_once("adminconnect.php");

$tbl_name="adminusers";


$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'];
$password =$_POST['password'];
$username = $_POST['username'];
$num =$_POST ['num'];


if($_POST["action"] == "signup"){

        $valid=1;

                if ($_POST['name']=="") {
			echo 'got no name<br>';
                $valid=0;
                $style_name = "background-color:#FF5959";
                $error_name = "Your name seems to be mising?<br>";
                                }

			if ($address == "" || strlen($address) < 2) {
    			echo 'got no address1<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address = "There is a problem with the address field?<br>";
							}


			if ($address1 == "" || strlen($address1) < 2) {
    			echo 'got no address1<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address1 = "There is a problem with the address field?<br>";
							}

			if ($address2 == "" || strlen($address2) < 2) {
    			echo 'got no address2<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address2 = "There is a problem with the address field?<br>";
							}

			if ($address3 == "" || strlen($address3) < 2) {
    			echo 'got no address3<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address3 = "There is a problem with the address field?<br>";
							}

			if ($address4 == "" || strlen($address4) < 2) {
    			echo 'got no address4<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address4 = "There is a problem with the address field?<br>";
							}
			if ($county == "" || strlen($county)<2) {
			echo 'got no county<br>';
                $valid=0;
                $style_county = "background-color:#FF5959";
                $error_county = "The County field is blank?<br>";
        						} 
			if ($zip == "" || strlen($zip)<2) {
			echo 'got no zip<br>';
                $valid=0;
                $style_zip = "background-color:#FF5959";
                $error_zip = "Theres a problem with the zip code?<br>";
        						}   
			if (!eregi("^[0-9]+",$telephone)) {
			echo 'got no phone<br>';
                $valid=0;
                $style_telephone = "background-color:#FF5959";
                $error_telephone = "Theres a problem with the telephone number?<br>";
        						}   
			  if (!eregi("^[A-Za-z0-9.-]+",$email)) {
			echo 'got no mail';
                $valid=0;
                $style_email = "background-color:#FF5959";
                $error_email = "Theres a problem with the email address?<br>";
       						 	}
        
        		if ($password == "" || strlen($password)<7) {
			echo 'got no password';
                $valid=0;
                $style_password = "background-color:#FF5959";
                $error_password = "Theres a problems with your password?<br>";
       							 }      


$user = mysql_real_escape_string(htmlspecialchars($_POST['username']));


$sql = "SELECT name FROM adminusers WHERE username ='$user'";
echo ".$user.";
$result = mysql_query($sql) or die("Error in SQL: ".mysql_error());
$row = mysql_fetch_array($result);
$count = mysql_num_rows($result);

$test = $row['name'];


			if ($count > 0) { // username should only exist once.
			$valid=0;
			$style_username = "background-color:#FF5959";
			$error_username = "Error! The username " . $user . " already exists in the database.";
							}

			if ($password == "" || strlen($password)<7) {
                $valid=0;
                $style_password = "background-color:#FF5959";
                $error_password = "Theres a problems with your password?<br>";

        						}
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)";
echo $sql;

$result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql");
}
}
?>
<!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="file:///C|/Users/Mike/Documents/Admin_files/wrapper.js"></script>
</head>
<body>
<div id="Box">
  <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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" type="text" 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" type="text" 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" type="text" 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" type="text" 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" type="text" 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" type="text" 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"><? echo $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>

Link to comment
Share on other sites

The problem lies specifically in your echoing the values here..

 

<input name="name" type="text" size="32" style="font-size: 8pt; $style_name; float:left" value="[u]<?php echo $name; ?>[/u]"></td>

 

Also quick random question.  Why are you even echoing the form after someone registers?  Shouldn't you redirect them to a different page and/or a thank you page????

Link to comment
Share on other sites

<?php
require_once("adminconnect.php");

$tbl_name="adminusers";


$name = mysql_real_escape_string(trim($_POST['name']));
$address = mysql_real_escape_string(trim($_POST['address']));
$address1 = mysql_real_escape_string(trim($_POST['address1']));
$address2 = mysql_real_escape_string(trim($_POST['address2']));
$address3 = mysql_real_escape_string(trim($_POST['address3']));
$address4 = mysql_real_escape_string(trim($_POST['address4']));
$county = mysql_real_escape_string(trim($_POST['county']));
$zip = mysql_real_escape_string(trim($_POST['zip']));
$telephone = mysql_real_escape_string(trim($_POST['telephone']));
$email = mysql_real_escape_string(trim($_POST['email']));
$password =mysql_real_escape_string(trim($_POST['password']));
$username = mysql_real_escape_string(trim($_POST['username']));
$num =mysql_real_escape_string(trim$_POST['num']));


if($_POST["action"] == "signup"){

        $valid=1;

                if ($_POST['name']==""||empty($_POST['name'])) {
			echo 'got no name<br>';
                $valid=0;
                $style_name = "background-color:#FF5959";
                $error_name = "Your name seems to be mising?<br>";
                                }

			if ($address == "" ||empty($adress)|| strlen($address) < 2) {
    			echo 'got no address1<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address = "There is a problem with the address field?<br>";
							}


			if ($address1 == "" ||empty($adress1)|| strlen($address1) < 2) {
    			echo 'got no address1<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address1 = "There is a problem with the address field?<br>";
							}

			if ($address2 == "" ||empty($adress2)|| strlen($address2) < 2) {
    			echo 'got no address2<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address2 = "There is a problem with the address field?<br>";
							}

			if ($address3 == "" ||empty($adress3)|| strlen($address3) < 2) {
    			echo 'got no address3<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address3 = "There is a problem with the address field?<br>";
							}

			if ($address4 == "" ||empty($adress4)|| strlen($address4) < 2) {
    			echo 'got no address4<br>';//added by me to denote failure in this statement 
  		 		$valid=0;
   				$style_address = "background-color:#FF5959";
  				$error_address4 = "There is a problem with the address field?<br>";
							}
			if ($county == "" ||empty($county)|| strlen($county)<2) {
			echo 'got no county<br>';
                $valid=0;
                $style_county = "background-color:#FF5959";
                $error_county = "The County field is blank?<br>";
        						} 
			if ($zip == "" ||empty($zip)|| strlen($zip)<2) {
			echo 'got no zip<br>';
                $valid=0;
                $style_zip = "background-color:#FF5959";
                $error_zip = "Theres a problem with the zip code?<br>";
        						}   
			if (!eregi("^[0-9]+",$telephone)) {
			echo 'got no phone<br>';
                $valid=0;
                $style_telephone = "background-color:#FF5959";
                $error_telephone = "Theres a problem with the telephone number?<br>";
        						}   
			  if (!eregi("^[A-Za-z0-9.-]+",$email)) {
			echo 'got no mail';
                $valid=0;
                $style_email = "background-color:#FF5959";
                $error_email = "Theres a problem with the email address?<br>";
       						 	}
        
        		if ($password == "" ||empty($password)|| strlen($password)<7) {
			echo 'got no password';
                $valid=0;
                $style_password = "background-color:#FF5959";
                $error_password = "Theres a problems with your password?<br>";
       							 }      


$user = trim(mysql_real_escape_string(htmlspecialchars($_POST['username'])));


$sql = "SELECT  FROM adminusers WHERE username ='$user'";
echo ".$user.";
$result = mysql_query($sql) or die("Error in SQL: ".mysql_error());
$row = mysql_fetch_array($result);
$count = mysql_num_rows($result);

$test = $row['name'];


			if ($count > 0) { // username should only exist once.
			$valid=0;
			$style_username = "background-color:#FF5959";
			$error_username = "Error! The username " . $user . " already exists in the database.";
							}

			if ($password == "" ||empty($password)|| strlen($password)<7) {
                $valid=0;
                $style_password = "background-color:#FF5959";
                $error_password = "Theres a problems with your password?<br>";

        						}
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)";
echo $sql;

$result=mysql_query($sql)or die(mysql_error()."<p>With Query<br>$sql");
}
}
?>
<!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="file:///C|/Users/Mike/Documents/Admin_files/wrapper.js"></script>
</head>
<body>
<div id="Box">
  <div id="logoBox"><a href="http://www.btrax.com/" target="_blank"><img src="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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="file:///C|/Users/Mike/Documents/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" type="text" 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" type="text" 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" type="text" 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" type="text" 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" type="text" 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" type="text" 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"><? echo $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>

Link to comment
Share on other sites

Im getting the following errors with the new code when all the fields are complete and valid

 

got no address1

got no address1

got no address2

got no address3

got no address4

.gggggggggg.Error in SQL: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM adminusers WHERE username ='gggggggggg'' at line 1

Link to comment
Share on other sites

mysql_real_escape_string() does exactly what it does on the can... It escapes $_POST's amongst other things correctly so you can't get the dreaded sql injection with ' or 1=1 etc

 

try reading: www.php.net/mysql_real_escape_string

Link to comment
Share on other sites

Thanks, just wasnt sure why it was used.

 

Still cant figure out why im now getting the errors

 

Im getting the following errors with the new code when all the fields are complete and valid

 

got no address1

got no address1

got no address2

got no address3

got no address4

.gggggggggg.Error in SQL: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM adminusers WHERE username ='gggggggggg'' at line 1

 

 

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.