Hi Everybody Can somebody Help me.this is my form cod that iam doing in xampp

<form name="form" action='registernow.php' method="post">
<table height="40">
<table left="50">
<table right="20">
<tr>
<td >
        <vllabel errclass="error" validators="NameReq,NameRegExp" for="Name" cerrclass="controlerror">Name:</vllabel> 
      </td> 
      <td> 
        <input name="Name" type="text" class="control" id="Name" size="21"> 
        <vlvalidator type="required" name="NameReq" control="Name" errmsg="Name required"> 
        <vlvalidator type="regexp" name="NameRegExp" control="Name" regexp="/^[A-Za-z'\s]*$/" errmsg="Invalid Name"> 
      </td>
</td>
</tr>
<tr> 
      <td> 
        <vllabel errclass="error" validators="Password,PassCmp" for="Password" cerrclass="controlerror">Password:</vllabel> 
      </td> 
      <td> 
        <input name="Password" type="password" class="control" id="Password" size="21"> 
        <vlvalidator type="required" name="Password" control="Password" errmsg="Password required"> 
        <vlvalidator name="PassCmp" type="compare" control="Password" comparecontrol="Password2" 
          operator="e" validtype="string" errmsg="Both Password fields must be equal"> 
      </td> 
    </tr> 

</tr>
<tr> 
      <td> 
        <vllabel validators="Password,PassCmp" errclass="error" for="Password2" cerrclass="controlerror">Confirm Password:</vllabel> 
      </td> 
      <td> 
        <input name="Password2" type="PASSWORD" class="control" id="Password2" size="21"> 
      </td> 
    </tr> 
      <td> 
        <vllabel errclass="error" validators="EmailReq,Email" for="Email" cerrclass="controlerror">E-mail:</vllabel> 
      </td> 
      <td> 
        <input name="Email" type="TEXT" class="control" id="Email" size="21"> 
        <vlvalidator type="required" name="EmailReq" control="Email" errmsg="E-mail required"> 
        <vlvalidator type="format" format="email" name="Email" control="Email" errmsg="Invalid E-mail"> 
      </td> 
       </tr> 
<tr> 
      <td colspan=2> 
        <input name="Agreement" type="checkbox" id="Agreement" value="1"> 
        <vllabel errclass="error" validators="Agreement" for="Agreement">I agree with the terms of service</vllabel> 
        <vlvalidator type="required" name="Agreement" control="Agreement" errmsg="Agreement checkbox must be selected"> 
      </td> 
    </tr> 
</tr>
</table>
<p>
  <input name='submit' type='submit' value='Register' />
   <input type="reset" class="control" value="Reset"> 
</form>

and this is my php code for registration cod

<?php

$Name = strip_tags ($_POST["Name"]);
$passwordHash = strip_tags($_POST["password"]);
$repeatpassword= strip_tags($_POST['rpass']);
$email =$_POST["email"];
$date = date("Y-m-d");

$connect= mysql_connect("localhost","root","root") or die("connection failed");
mysql_select_db("phplogin") or die("coldn't find it");


$insertquery = 'insert into 	users (
					Name,
					password,
					email
					) 
					values
					(
					"' . $_POST['Name'] . '", 
					"' . sha1($_POST['password']) . '",
					"' . $_POST['email'] . '"
					)';

mysql_query($insertquery);
echo "thank you for registering";
mysql_close($connect);
	
?>

and it give error at <php> when i click on register
the error are like
Notice: Undefined index: password in D:\xampp\htdocs\OMT\registernow.php on line 4
Notice: Undefined index: password in D:\xampp\htdocs\OMT\registernow.php on line 5
Notice: Undefined index: password in D:\xampp\htdocs\OMT\registernow.php on line 6
Notice: Undefined index: password in D:\xampp\htdocs\OMT\registernow.php on line 21
Notice: Undefined index: password in D:\xampp\htdocs\OMT\registernow.php on line 22

Recommended Answers

All 11 Replies

In my point of view,

In Form you had declared.

<input name="Password" type="password" class="control" id="Password" size="21">

<input name="Password2" type="PASSWORD" class="control" id="Password2" size="21">


but in registernow.php your calling

$passwordHash = strip_tags($_POST["password"]);
$repeatpassword= strip_tags($_POST);

its should be

$passwordHash = strip_tags($_POST["Password"]);
$repeatpassword= strip_tags($_POST);

please let me know if there is still error.

Try Password , capitalizing the first letter, as in the input's name

I try by captail p but now it is not give me error but it show the blank page when clik on register and data is not going to store in data base

$passwordHash = strip_tags($_POST["Password"]);
$repeatpassword= strip_tags($_POST['Password2']);

You have to specify a connection to the mysql_query function:

mysql_query($insertquery, $connection);

Also, try to standarize your quotation marks and colons, since you tend to use both for the same thing:

$passwordHash = strip_tags($_POST["Password"]);
$repeatpassword= strip_tags($_POST['Password2']);

Try doing both like this always:

$passwordHash = strip_tags($_POST['Password']);
$repeatpassword= strip_tags($_POST['Password2']);

Or like this:

$passwordHash = strip_tags($_POST["Password"]);
$repeatpassword= strip_tags($_POST["Password2"]);

Besides, you declared the variables and assigned them the $_POST values, but you didn't use them.

I tried on all these syntex but still the same problem

can you post your latest code?

Thank u Here it is

<div id="apDiv7">
      <form name="form" action='registernow.php' method="post">
<table height="40">
<table left="50">
<table right="20">
<tr>
<td >
        <vllabel errclass="error" validators="NameReq,NameRegExp" for="Name" cerrclass="controlerror">Name:</vllabel> 
      </td> 
      <td> 
        <input name="Name" type="text" class="control" id="Name" size="21"> 
        <vlvalidator type="required" name="NameReq" control="Name" errmsg="Name required"> 
        <vlvalidator type="regexp" name="NameRegExp" control="Name" regexp="/^[A-Za-z'\s]*$/" errmsg="Invalid Name"> 
      </td>
</td>
</tr>
<tr> 
      <td> 
        <vllabel errclass="error" validators="Password,PassCmp" for="Password" cerrclass="controlerror">Password:</vllabel> 
      </td> 
      <td> 
        <input name="Password" type="Password" class="control" id="Password" size="21"> 
        <vlvalidator type="required" name="Password" control="Password" errmsg="Password required"> 
        <vlvalidator name="PassCmp" type="compare" control="Password" comparecontrol="Password2" 
          operator="e" validtype="string" errmsg="Both Password fields must be equal"> 
      </td> 
    </tr> 

</tr>
<tr> 
      <td> 
        <vllabel validators="Password,PassCmp" errclass="error" for="Password2" cerrclass="controlerror">Confirm Password:</vllabel> 
      </td> 
      <td> 
        <input name="Password2" type="PASSWORD" class="control" id="Password2" size="21"> 
      </td> 
    </tr> 
      <td> 
        <vllabel errclass="error" validators="EmailReq,Email" for="Email" cerrclass="controlerror">E-mail:</vllabel> 
      </td> 
      <td> 
        <input name="Email" type="TEXT" class="control" id="Email" size="21"> 
        <vlvalidator type="required" name="EmailReq" control="Email" errmsg="E-mail required"> 
        <vlvalidator type="format" format="email" name="Email" control="Email" errmsg="Invalid E-mail"> 
      </td> 
       </tr> 
<tr> 
      <td colspan=2> 
        <input name="Agreement" type="checkbox" id="Agreement" value="1"> 
        <vllabel errclass="error" validators="Agreement" for="Agreement">I agree with the terms of service</vllabel> 
        <vlvalidator type="required" name="Agreement" control="Agreement" errmsg="Agreement checkbox must be selected"> 
      </td> 
    </tr> 
</tr>
</table>
<p>
  <input name='submit' type='submit' value='Register' />
   <input type="reset" class="control" value="Reset"> 
</form>
    </div>
<?php

$Name = strip_tags ($_POST["Name"]);
$passwordHash = strip_tags($_POST["Password"]);
$repeatpassword= strip_tags($_POST["Password2"]);


$email =$_POST["email"];
$date = date("Y-m-d");

$connect= mysql_connect("localhost","root","root") or die("connection failed");
mysql_select_db("phplogin") or die("coldn't find it");


$insertquery = 'insert into 	users (
					Name,
					password,
					email
					) 
					values
					(
					"' . $_POST["Name"] . '", 
					"' . sha1($_POST["Password"]) . '",
					"' . $_POST["email"] . '"
					)';
mysql_query($insertquery, $connect);
echo "thank you for registering";
mysql_close($connect);
	
?>

switch the quotation marks in the query, since mysql won't take quotations (" ").

$insertquery = "insert into users(Name, password, email) values('" . $_POST['Name']
               . "', '" . sha1($_POST['Password'] . "', '" . $_POST['email'] . "')";

Thank u Friend for you help. but it still displaying blank page and not registar in database. I dont know but there is still small mistake in it that couldnt fix it. I will try to fix..

Sorry friends the mistake was in my table because there which need to be name but in my table was (user name). At last I correrected it.now it is working. Thanks for ur Help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.