Page 1 of 1

Creating a register Form Help !

Posted: Sun Apr 19, 2009 11:01 pm
by Nobbsinator
i have ceated a sign up register form in php however when i run the coode and enter information and click submit the useer not added page is always displayed. can anyone help me ?

Code: Select all

 
<?php
 
$cemail_address=$_POST["cemail_address"];
$cpassword=$_POST["cpassword"];
$ctitle=$_POST["ctitle"];
$cfirst_name=$_POST["cfirst_name"];
$clast_name=$_POST["clast_name"];
$cphone_number=$_POST["cphone_number"];
 
if (!isset($cemail_address))
    {
    
 
    echo("<p>Please enter the new user details below:<p>");
    echo("<form action = \"" . $PHP_SELF . "\" method = \"POST\">");
    
    echo("Email Address <input type = \"text\" name = \"cemail_address\"><br>");
    echo("Password <input type = \"password\"name = \"cpassword\"><br>");
    echo("Title <select name=\"ctitle\">");
    echo("<option value=\"Mr\">Mr</option>");
    echo("<option value=\"Mrs\">Mrs</option>");
    echo("<option value=\"Ms\">Ms</option>");
    echo("<option value=\"Dr\">Dr</option>");
    echo("</select><br>");
    echo("First Name <input type = \"text\" name = \"cfirst_name\"><br>");
    echo("Last Name <input type = \"text\" name = \"clast_name\"><br>");
    echo("Phone Number <input type = \"number\" name = \"cphone_number\"><br>");
    echo("<input type = \"submit\" value = \"Submit\">");
    echo("</form>");
 
    }
else
    {
 
    include ("opendbinclude.php");
    $query = "INSERT INTO user VALUES
    ('$cemail_address','$cpassword','$ctitle','$cfirst_name','$clast_name','$cphone_number')";  
    $result=mysql_query($query);
    if ($result)
    
        {
        echo include("C:\AppServ\www\UNI\User Added.php");
        
            }
    else
        {
        echo include ("C:\AppServ\www\UNI\User Not Added.php");
        
        }
}
?>
 
 

Re: Creating a register Form Help !

Posted: Mon Apr 20, 2009 12:44 am
by MasterBeta
Change line 39 to

Code: Select all

$result=mysql_query($query) or die(mysql_error());
and see what error your mysql query is getting.

Re: Creating a register Form Help !

Posted: Mon Apr 20, 2009 1:01 am
by nmreddy
try this query

$query = "INSERT INTO user VALUES ('".$cemail_address."','".$cpassword."','".$ctitle."','".$cfirst_name."','".$clast_name."','".$cphone_number."')";