Jump to content

[SOLVED] User Registration Form....got a few small errors.


Fabio9999

Recommended Posts

Hello there,

 

I have tried to create a registration form for Users to register.

I have run through the code multiple times and I have been a witness to a strange phenomena.

Allthough it insists that registration succeeded however there is no entries in the database.

 

this is my src.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?PHP   
error_reporting(E_ALL);

    // register2.php  
    include("config.php");  
     $errors = "";  
 if (!isset($_POST['title']))  
     $errors .= "Please provide a title. <br/>"; 
     if (!isset($_POST['first_name']))  
     $errors .= "Please provide a firstname. <br/>";  
     if (!isset($_POST['surname']))  
     $errors .= "Please provide a surname. <br/>";  
     if (!isset($_POST['street']))  
     $errors .= "Please provide a street. <br/>";
     if (!isset($_POST['town']))  
     $errors .= "Please provide a town. <br/>";
 if (!isset($_POST['county']))  
     $errors .= "Please provide a county. <br/>";
 if (!isset($_POST['postcode']))  
     $errors .= "Please provide a postcode. <br/>";
 if (!isset($_POST['email_adress']))  
     $errors .= "Please provide an email adress. <br/>";
     if ($errors == "") {  
       $sql= "INSERT INTO customer_webair (id, title,first_name, surname, street, town, county, postcode, email_adress) VALUES(  
                             
					   '".addslashes($_POST['title'])."',
                           '".addslashes($_POST['first_name'])."',  
                           '".addslashes($_POST['surname'])."',  
					   '".addslashes($_POST['street'])."',
					   '".addslashes($_POST['town'])."',
					   '".addslashes($_POST['county'])."',
					   '".addslashes($_POST['postcode'])."',
					   '".addslashes($_POST['email_adress'])."',
                             
                           )" or die(mysql_error());  
       echo "Registration Successful!";  
     } else {  
        echo $errors."Please go back and try again.";  
    }   
?>  

</body>
</html>

 

Thanks a lot any hints appreciated.

 

Fabio

Link to comment
Share on other sites

is your field `id` in the database auto increment?

Yes it is.

 

 

@Will1990:

Yes database & tablename are correct and I checked on the case sensitivity.

"Column Count Doesn't Match Value Count At Row 1" was the only error I received previously but I managed to get rid of it by myself.

 

Thanks for both of your replies.

Link to comment
Share on other sites

change this

 

       $sql= "INSERT INTO customer_webair (id, title,first_name, surname, street, town, county, postcode, email_adress) VALUES( 
                             
                     '".addslashes($_POST['title'])."',
                           '".addslashes($_POST['first_name'])."', 
                           '".addslashes($_POST['surname'])."', 
                     '".addslashes($_POST['street'])."',
                     '".addslashes($_POST['town'])."',
                     '".addslashes($_POST['county'])."',
                     '".addslashes($_POST['postcode'])."',
                     '".addslashes($_POST['email_adress'])."',
                             
                           )" or die(mysql_error());

 

 

to this

 

 

       $sql= mysql_query("INSERT INTO customer_webair (title,first_name, surname, street, town, county, postcode, email_adress) VALUES( 
                             
                     '".addslashes($_POST['title'])."',
                           '".addslashes($_POST['first_name'])."', 
                           '".addslashes($_POST['surname'])."', 
                     '".addslashes($_POST['street'])."',
                     '".addslashes($_POST['town'])."',
                     '".addslashes($_POST['county'])."',
                     '".addslashes($_POST['postcode'])."',
                     '".addslashes($_POST['email_adress'])."',
                             
                           )") or die(mysql_error());

Link to comment
Share on other sites

change this

 

       $sql= "INSERT INTO customer_webair (id, title,first_name, surname, street, town, county, postcode, email_adress) VALUES( 
                             
                     '".addslashes($_POST['title'])."',
                           '".addslashes($_POST['first_name'])."', 
                           '".addslashes($_POST['surname'])."', 
                     '".addslashes($_POST['street'])."',
                     '".addslashes($_POST['town'])."',
                     '".addslashes($_POST['county'])."',
                     '".addslashes($_POST['postcode'])."',
                     '".addslashes($_POST['email_adress'])."',
                             
                           )" or die(mysql_error());

 

 

to this

 

 

       $sql= mysql_query("INSERT INTO customer_webair (title,first_name, surname, street, town, county, postcode, email_adress) VALUES( 
                             
                     '".addslashes($_POST['title'])."',
                           '".addslashes($_POST['first_name'])."', 
                           '".addslashes($_POST['surname'])."', 
                     '".addslashes($_POST['street'])."',
                     '".addslashes($_POST['town'])."',
                     '".addslashes($_POST['county'])."',
                     '".addslashes($_POST['postcode'])."',
                     '".addslashes($_POST['email_adress'])."',
                             
                          

 

I changed that but now I get an error in the line following " )") or die(mysql_error());"

echo "Registration Successful!"
      } else {  
        echo $errors."Please go back and try again.";  
    }   
?>  

 

Thanks for your help so far, I really appreciate it

 

 

Link to comment
Share on other sites

The error I received:

 

Parse error: syntax error, unexpected ')' in /nas/students/f/fmuller/unix/public_html/register2.php on line 44

 

Code used:

 

<?php 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?PHP   
error_reporting(E_ALL);

    // register2.php  
    include("config.php");  
     $errors = "";  
 if (!isset($_POST['title']))  
     $errors .= "Please provide a title. <br/>"; 
     if (!isset($_POST['first_name']))  
     $errors .= "Please provide a firstname. <br/>";  
     if (!isset($_POST['surname']))  
     $errors .= "Please provide a surname. <br/>";  
     if (!isset($_POST['street']))  
     $errors .= "Please provide a street. <br/>";
     if (!isset($_POST['town']))  
     $errors .= "Please provide a town. <br/>";
 if (!isset($_POST['county']))  
     $errors .= "Please provide a county. <br/>";
 if (!isset($_POST['postcode']))  
     $errors .= "Please provide a postcode. <br/>";
 if (!isset($_POST['email_adress']))  
     $errors .= "Please provide an email adress. <br/>";
     if ($errors == "") {  
      $sql= mysql_query("INSERT INTO customer_webair (title,first_name, surname, street, town, county, postcode, email_adress) VALUES( 
                             
                     '".addslashes($_POST['title'])."',
                           '".addslashes($_POST['first_name'])."', 
                           '".addslashes($_POST['surname'])."', 
                     '".addslashes($_POST['street'])."',
                     '".addslashes($_POST['town'])."',
                     '".addslashes($_POST['county'])."',
                     '".addslashes($_POST['postcode'])."',
                     '".addslashes($_POST['email_adress'])."',
                           )") or die(mysql_error()); 
       echo "Registration Successful!"  
     } else {  
        echo $errors."Please go back and try again.";  
    }   
?>  

</body>
</html>

 

Thanks lads

Link to comment
Share on other sites

try this

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?PHP   
error_reporting(E_ALL);

    // register2.php 
    include("config.php"); 
     $errors = ""; 
    if (!isset($_POST['title'])) 
     $errors .= "Please provide a title. <br/>";
     if (!isset($_POST['first_name'])) 
     $errors .= "Please provide a firstname. <br/>"; 
     if (!isset($_POST['surname'])) 
     $errors .= "Please provide a surname. <br/>"; 
     if (!isset($_POST['street'])) 
     $errors .= "Please provide a street. <br/>";
     if (!isset($_POST['town'])) 
     $errors .= "Please provide a town. <br/>";
    if (!isset($_POST['county'])) 
     $errors .= "Please provide a county. <br/>";
    if (!isset($_POST['postcode'])) 
     $errors .= "Please provide a postcode. <br/>";
    if (!isset($_POST['email_adress'])) 
     $errors .= "Please provide an email adress. <br/>";
     if ($errors == "") { 
      $sql= mysql_query("INSERT INTO customer_webair (title,first_name, surname, street, town, county, postcode, email_adress) VALUES(
                             
                     '".addslashes($_POST['title'])."',
                           '".addslashes($_POST['first_name'])."',
                           '".addslashes($_POST['surname'])."',
                     '".addslashes($_POST['street'])."',
                     '".addslashes($_POST['town'])."',
                     '".addslashes($_POST['county'])."',
                     '".addslashes($_POST['postcode'])."',
                     '".addslashes($_POST['email_adress'])."',
                           )") or die(mysql_error());
       echo "Registration Successful!"; 
     } else { 
        echo $errors."Please go back and try again."; 
    }   
   ?> 

</body>
</html>

Link to comment
Share on other sites

we're getting there slowly

 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?PHP   
error_reporting(E_ALL);

    // register2.php 
    include("config.php"); 
     $errors = ""; 
    if (!isset($_POST['title'])) 
     $errors .= "Please provide a title. <br/>";
     if (!isset($_POST['first_name'])) 
     $errors .= "Please provide a firstname. <br/>"; 
     if (!isset($_POST['surname'])) 
     $errors .= "Please provide a surname. <br/>"; 
     if (!isset($_POST['street'])) 
     $errors .= "Please provide a street. <br/>";
     if (!isset($_POST['town'])) 
     $errors .= "Please provide a town. <br/>";
    if (!isset($_POST['county'])) 
     $errors .= "Please provide a county. <br/>";
    if (!isset($_POST['postcode'])) 
     $errors .= "Please provide a postcode. <br/>";
    if (!isset($_POST['email_adress'])) 
     $errors .= "Please provide an email adress. <br/>";
     if ($errors == "") { 
      $sql= mysql_query("INSERT INTO customer_webair (title,first_name, surname, street, town, county, postcode, email_adress) VALUES(
                             
                     '".addslashes($_POST['title'])."',
                           '".addslashes($_POST['first_name'])."',
                           '".addslashes($_POST['surname'])."',
                     '".addslashes($_POST['street'])."',
                     '".addslashes($_POST['town'])."',
                     '".addslashes($_POST['county'])."',
                     '".addslashes($_POST['postcode'])."',
                     '".addslashes($_POST['email_adress'])."'
                           )") or die(mysql_error());
       echo "Registration Successful!"; 
     } else { 
        echo $errors."Please go back and try again."; 
    }   
   ?> 

</body>
</html>

Link to comment
Share on other sites

we're getting there slowly

 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>

<?PHP   
error_reporting(E_ALL);

    // register2.php 
    include("config.php"); 
     $errors = ""; 
    if (!isset($_POST['title'])) 
     $errors .= "Please provide a title. <br/>";
     if (!isset($_POST['first_name'])) 
     $errors .= "Please provide a firstname. <br/>"; 
     if (!isset($_POST['surname'])) 
     $errors .= "Please provide a surname. <br/>"; 
     if (!isset($_POST['street'])) 
     $errors .= "Please provide a street. <br/>";
     if (!isset($_POST['town'])) 
     $errors .= "Please provide a town. <br/>";
    if (!isset($_POST['county'])) 
     $errors .= "Please provide a county. <br/>";
    if (!isset($_POST['postcode'])) 
     $errors .= "Please provide a postcode. <br/>";
    if (!isset($_POST['email_adress'])) 
     $errors .= "Please provide an email adress. <br/>";
     if ($errors == "") { 
      $sql= mysql_query("INSERT INTO customer_webair (title,first_name, surname, street, town, county, postcode, email_adress) VALUES(
                             
                     '".addslashes($_POST['title'])."',
                           '".addslashes($_POST['first_name'])."',
                           '".addslashes($_POST['surname'])."',
                     '".addslashes($_POST['street'])."',
                     '".addslashes($_POST['town'])."',
                     '".addslashes($_POST['county'])."',
                     '".addslashes($_POST['postcode'])."',
                     '".addslashes($_POST['email_adress'])."'
                           )") or die(mysql_error());
       echo "Registration Successful!"; 
     } else { 
        echo $errors."Please go back and try again."; 
    }   
   ?> 

</body>
</html>

 

Thanks dude its finally working i love you man (no homo)

 

Cheers

 

Fabio

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.