Click here to Skip to main content
15,895,798 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PHP
	include ('connection.php');



if (isset($_POST['register']))

	{

		$vpassword = $_POST['zpassword'];
		$vconfirmpassword = $_POST['cpassword'];

			if ('vpassword' == 'vconfirmpassword')

				 {

				$vfirst = $_POST['first'];
				$vmiddle = $_POST['middle'];	
				$vlast = $_POST['last'];
				$vcourse = $_POST['course'];
				$vlevel = $_POST['level'];
				$vschoolid = $_POST['schoolid'];
				$vpassword = $_POST['password'];

				mysql_select_db($db,$conn);
				$query = "insert into schoolid_tbl (`firstname`,`lastname`,`course`,`level`,`schoolid`,`password`) values ('$vfirst','$vlast','$vcourse','$vlevel','$vschoolid','$vpassword')";
				mysql_query($query);

				header('location:home.php?msg="registered"');

				}

	}


?>

____________________________________________________________________________

what my plan is the password in registration should match to the confirm password before submiting the record to save in tables and before proceeding to the next page

NEWBIE HERE:)
self studying ...
teach me how please ....
sorry for my bad english ...
and if i have bad source ^^
Posted
Updated 24-Oct-14 2:29am
v2

1 solution

PHP
<?php <br mode="hold" /?>
$vpassword = $_POST['zpassword'];
$vconfirmpassword = $_POST['cpassword'];

if ($vpassword == $vconfirmpassword ) {
     /* your database insert code... */

} else  {
     echo '<script language="javascript">';
     echo 'alert("You entered two different passwords")';
     echo '</script>';
}
 
Share this answer
 
Comments
ZRCSarmiento 24-Oct-14 8:50am    
Sir DanielSL

how about the submit button ?
thank you..

your code works..
but redirecting to the next page .. skipping the registration because the password and the confirm password are same (blank) .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900