Results 1 to 3 of 3

Thread: register form problem

  1. #1
    Join Date
    Jul 2010
    Location
    NangYang
    Posts
    20
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default register form problem

    Hi friends,
    I have 1 problem with registration form
    the code is here
    PHP Code:
    <center>
    <
    div align="left">
    <
    form action="buffered_register.php" method=post enctype="multipart/form-data">
    <
    fieldset>
      <
    p><aName</a>
      <
    input type=text size=40 name="real_name" />
      <
    br /> Age
      
    <input type=text size=10 name="age" />
      <
    br>Username</br>
      <
    input type=text size=40 name="user_name" />
      <
    br /> Password
      
    <input type=password size=10 name="pass_word" />
      <
    br /> Email
      
    <input type=text size=40 name="email" />
      <
    br /> Current Address
      
    <input type=name size=40 name"location" />
      <
    br /> Upload Avatar
      
    <input type=file name="avatar">
      </
    p>
      </
    fieldset>
      <
    p>
        <
    input style=" background-color:#0F6" type=submit name=ok value="OK all" />
      </
    p>
    </
    form>
    </
    div>
    </
    center
    the bufferedregister.php
    PHP Code:
    <?php 
    include ("dbconnect1.php");
    header("Content-type: image/jpeg");
    header("location: index.php");

        
    $name=$_POST['real_name'];
        
    $age=$_POST['age'];
        
    $username=$_POST['user_name'];
        
    $password=$_POST['pass_word'];
        
    $email=$_POST[email];
        
    $location=$_POST['location'];
        
    // THIS CODE FOR UPLOAD AVATAR
         
    move_uploaded_file($_FILES["avatar"]["tmp_name"],
          
    "img/upload/avatar/" $_FILES["avatar"]["name"]);
         
    $url="img/upload/avatar/" $_FILES["avatar"]["name"];
        
        
          
    $sql="select * from guestbook where user_name='".$username."'";
          
    $query=mysql_query($sql);
          
    $count=0;
        while(
    $row=mysql_fetch_array($query)){$count++;}
         
    //if(msql_num_rows($sql))
         
    if($count==0)
         {
    $query="insert into guestbook(name,age,address,user_name,password,email,image) values ('$name','$age','$location','$username','password','$email','$url')";
    mysql_query($query) or die(mysql_error());
    }
    and table guestbook
    Code:
    Field  	Type   	Null  	Default   	Comments
    name 	varchar(20) 	No  	noname  	 
    user_name 	varchar(20) 	No  	noname  	 
    password 	varchar(20) 	No  	111111  	 
    age 	varchar(20) 	No  	000000  	 
    address 	varchar(20) 	No  	noaddress  	 
    id 	int(20) 	No  	  	 
    email 	varchar(20) 	No  	noemail  	 
    image 	varchar(50) 	No  	  	 
    Indexes: Documentation
    Keyname	Type	Unique	Packed	Field	Cardinality	Collation	Null	Comment
    PRIMARY	BTREE	Yes	No	id	10	A
    the problem is password input. Whatever passwords users input, they will be inserted to database as "password". Other fields work well.
    So what is the problem ?
    Can someone point it out for me?
    thanks.

  2. #2
    Join Date
    Jul 2010
    Posts
    1
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    in php

    $email=$_POST['email'];

    you forget to put '$' sign in password:
    $query="insert into guestbook(name,age,address,user_name,password,email,image) values

    ('$name','$age','$location','$username','$password','$email','$url')";
    mysql_query($query) or die(mysql_error());

  3. The Following User Says Thank You to ashokmhrj For This Useful Post:

    jangkoo (07-24-2010)

  4. #3
    Join Date
    Jul 2010
    Location
    NangYang
    Posts
    20
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    OMG. Thank you very much. I tried to figure it out but couldnt see that.
    :-<.
    Thanks alot.

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
  •