Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
this signup.php
HTML
<form method="post" action="reg.php">
    <div id="formStyle">
        <input type="text" name="email" placeholder="Enter your eMail">
        <input type="password" name="pass" placeholder="Enter your desire Password">              
        <input type="text" name="fname" placeholder="Enter your First Name">
        <input type="text" name="mname" placeholder="Enter your Middle Name">
        <input type="text" name="lname" placeholder="Enter your Last name">	
        <button id="logButton" type="submit">Sign Up</button>
                
        <div id="signButton">
             <a class="signLinkStyle" href="login.php">Log In</a>
        </div>             
    </div>			
</form>


this is reg.php
PHP
<?php
$con = mysqli_connect("localhost","root","123456");
mysqli_select_db("muchies");
if(mysqli_connect_errno())
{
	echo "Failed to connect to mysql:" . mysqli_connect_error();
}

$sql = mysqli_query(
	"INSERT INTO member (userMail,userPass,userFname,userMname,userLname)
	VALUES (NULL,$_POST[email],$_POST[pass],$_POST[fname],$_POST[mname],$_POST[lname])"
);

if(!mysqli_query($con,$add))
{
	die('Error: '.mysqli_error($con));
}
	echo "added";

mysql_close($con);
?>
Posted
Comments
fjdiewornncalwe 16-Aug-13 12:04pm    
Not how it works here.
Are you receiving errors? If so, what is the error.
This forum is for specific coding issues. We aren't here to do your debugging for you.
joshrduncan2012 16-Aug-13 12:50pm    
Agreed. My +5.
Adrian Manuel Tan Cleofe 17-Aug-13 7:04am    
sorry for my but english. im asking for some hint to fix my code and it's voluntary. .sorry :D
ZurdoDev 16-Aug-13 14:03pm    
There's a problem with the code. Can you find it?
[no name] 16-Aug-13 15:38pm    
For starters, your INSERT query is wrong. http://www.w3schools.com/sql/sql_insert.asp. The number of values to write must match the number of columns.

SQL
"INSERT INTO member (userMail,userPass,userFname,userMname,userLname)
    VALUES (NULL,'$_POST[email]','$_POST[pass]','$_POST[fname]','$_POST[mname]','$_POST[lname]')"


I would suggest you to use this.
 
Share this answer
 
In the below INSERT query, you have an extra NULL parameter.

Remove that and try.
SQL
INSERT INTO member 
(userMail, userPass, userFname, userMname, userLname)
VALUES 
(NULL, $_POST[email], $_POST[pass], $_POST[fname], $_POST[mname], $_POST[lname])
 
Share this answer
 

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