Results 1 to 3 of 3

Thread: Creating a Registration form

  1. #1
    Join Date
    Dec 2010
    Posts
    30
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Exclamation Creating a Registration form

    Hi, I have a simple login and logout system but I want the users to be able to register themselves onto the database.

    I have looked at some code to do this but none of it works as im fairly new to PHP.

    I am getting error "Column count doesn't match value count at row 1"



    This is the action php code

    PHP Code:
    <?PHP   
      
    // register2.php  
      
    include("config.inc");  
      
    $errors "";  
      if (!isset(
    $_POST['username']))  
        
    $errors .= "Please provide a username. <br/>";  
      if (!isset(
    $_POST['password']))  
        
    $errors .= "Please provide a password. <br/>";  
      if (
    $errors == "") {  
        
    mysql_query("INSERT INTO user_list VALUES(  
                            '',  
                            '"
    .addslashes($_POST['username'])."',  
                            '"
    .md5($_POST['password'])."',
                            '"
    .time()."'  
                            )"
    ) or die(mysql_error());  
        echo 
    "Registration Successful!";  
      } else {  
         echo 
    $errors."Please go back and try again.";  
      }  
    ?>
    and this is the user interface code

    PHP Code:

    <!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=iso-8859-1" />
    <
    title>Untitled Document</title>
    </
    head>

    <
    body>

    <!-- 
    Register Page -->
    <
    form method="post" action="reg2.2.php">
      
    Username<br/><input type="text" name="username" maxlength="20" /><br/>
      
    Password<br/><input type="password" name="password" /><br/>
      <
    input type ="submit" />
    </
    form>


    </
    body>
    </
    html
    Last edited by arsenalbates; 01-25-2011 at 07:41 PM. Reason: Fixed parts myself and new problem arose

  2. #2
    Join Date
    Nov 2008
    Posts
    58
    Thanks
    0
    Thanked 7 Times in 7 Posts

  3. #3
    Join Date
    Jan 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default reply

    i thing you follow the w3school website which give you the step by step form geration or dani web solutions

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •