Author Topic: New to PHP form help  (Read 65 times)

Alvina

  • Guest
New to PHP form help
« on: January 26, 2012, 03:28:19 PM »
<body>
PHP Code: [Select]
<?php
$con 
mysql_connect("host ","username","password");
mysql_select_db("registration"$con);
$id=$_POST['id'];
$username=$_POST['username'];
$password=$_POST['password'];
$password=md5($pass); 
$confirm_password=$_POST['confirm_password'];
$Fname =$_POST['fname'];
$lname =$_POST['lname'];
$email =$_POST['email'];
$address =$_POST['address'];
$city =$_POST['city'];
$state =$_POST['state'];
$zip =$_POST['zip'];
$phone =$_POST['phone1'];
$phone =$_POST['phone2'];
$dob =$_POST['Birthday'];
$sex =$_POST['sex'];
$spouse =$_POST['spouse'];
$sdob =$_POST['sBirthday'];
$anniversary =$_POST['anniversary'];
$facebook =$_POST['facebook'];
$twitter =$_POST['twitter'];
$google =$_POST['googleplus'];
$linage =$_POST['linage'];
$parents =$_POST['parents'];
$grandparents =$_POST['grandparents'];
$error1="'Error! The username you have chosen already exists!"
$result mysql_query
   
("SELECT * FROM Registration WHERE
         username='$username'"
));
         if(
$result == 1)

          {
        
	
echo 
$error1;
          }
         else
          {
mysql_query("INSERT INTO Registration 
	
	
( username, password,fname,lname,email,address,city,state,zip,phone1,phone2,birthday,sex,spouse,
                  sbirthday,anniversary,facebook,twitter,googleplus,linage,parents,grandparents)

VALUES ('$username','$password','$firstname','$lastname','$email','$address','$city','$state','$zip','$phone',
	
	
'$dob','$sex','$spous','$sdob,'$anniversary','$facebook','$twitter','$google','$linage','$parents',
	
	
'$grandparents')"
);
mysql_close($con);

?>



I keep getting the following error
Parse error: syntax error, unexpected ')' in D:\Hosting\...... on line 60

Smokey PHP

  • Web Developer
  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 518
  • Karma: +5/-0
    • View Profile
Re: New to PHP form help
« Reply #1 on: January 26, 2012, 05:26:18 PM »
PHP Code: [Select]
$result mysql_query
   
("SELECT * FROM Registration WHERE
         username='$username'"
));//two closing brackets, remove one of them

technobizzmo

  • New Member
  • *
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: New to PHP form help
« Reply #2 on: January 26, 2012, 10:44:01 PM »
Just a note make sure you are using escape string for security
PHP Code: [Select]
$escaped_item mysql_escape_string($POST["item"]);

Then use strip_tags

PHP Code: [Select]
$escaped_item strip_tags($escaped_item);