when i'm creating register form database was connected but cant able to store the values from form into mysql

Recommended Answers

All 6 Replies

where's the code

Post your code clearly... We will help you...

<?php
$con = mysql_connect("localhost","root","" );
mysql_select_db("test",$con);
$name=$_REQUEST['name'];
$username=$_REQUEST['username'];
$pass1=$_REQUEST['pass1'];
$pass2=$_REQUEST['pass2'];
$email=$_REQUEST['email'];
$number=$_REQUEST['number'];
if(($_REQUEST['pass1'])==($_REQUEST['pass2']))
{
$sql="INSERT INTO register(name,username,pass1,pass2,email,number)VALUES ('".$name."','".$username."','".$pass1."','".$pass2."','".$email."','".$number."')"; 
$res=mysql_query($sql,$con) or die(mysql_error());
}
else
{
echo "Passwords aren't identical";
}

header("location:login.php");

?>

Ok.. Try this code by replacing insert statement.. It surely works..

$sql="INSERT INTO register(name,username,pass1,pass2,email,number)VALUES ('$name','$username','$pass1','$pass2','$email','$number')";

and additionally use exit; after echo statement in else part. This will automatically terminates the execution if condition not satisfied. Because, we should not use any output command before calling header() function..

Hope you can understand and solve your issue. If still probs, please let me know..

oh yeah it really works thank u friend

Fine Shenba... If you have any issues, dont worry... We are here... Feel free to communicate with us...

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.