-3

hey this is my user registration form (register_hirer.php)in which I'm trying to input details of an employee but its not working. its giving a parse error on line after: if (isset($_POST['submit']) which is just has a {.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>The Freelance World</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<body>
<?php

include"include/connection.php";
if (isset($_POST['submit'])
{

mysql_real_escape_string($_POST['username']);
$checkusername=mysql_query("SELECT * FROM employer WHERE eusername='{$_POST['username']}'");

    if (mysql_num_rows($checkusername)==1)
    {
        echo "username already exist";
    }
    else
    {
        $query = "insert into employer(efname,elname,egender,eemail,eusername,epwd,eadd,ephone,ecity,ecountry) values ('".$_POST['first_name']."','".$_POST['last_name']."','".$_POST['gender']."','".$_POST['email']."','".$_POST['username']."','".$_POST['password']."','".$_POST['address']."','".$_POST['phone']."','".$_POST['city']."','".$_POST['country']."')";

       $result = mysql_query($query) or die (mysql_error());

      echo " Thanks for registration";
 }
}       

?>

<form name="register_hirer" method="post" action="register_hirer.php" >
              <pre><strong>First Name</strong>         <input type="text" name="first_name" >               </pre>
              <pre><strong>Last Name   </strong>       <input type="text" name="last_name">               </pre>
              <pre><strong>Gender   </strong>          <input type="radio" name="gender" > Male  <input type="radio" name="gender" > Female </pre>
              <pre><strong>Email  </strong>            <input type="text" name="email">               </pre>
              <pre><strong>User Name </strong>         <input name="username" type="text" maxlength="10">               </pre>
              <pre><strong>Password    </strong>       <input type="password" name="password">   

<strong>
Postal Address  </strong>   <input type="text" name="address">   </pre>
              <pre><strong>Phone</strong>              <input type="text" name="phone">               </pre>
              <pre><strong>City   </strong>            <input type="text" name="city">               </pre>
              <pre><strong>Country       </strong>     <select name="country"><option selected>please select your country</option><option>Pakistan</option><option>US</option></select>     

                      <input type="submit" name="Submit" value="Submit">         </pre>
            </form>
</body>
</html>
Vaandu
  • 4,857
  • 12
  • 49
  • 75
rabeea
  • 7
  • 1
  • 2
    You're also using mysql_real_escape_string incorrectly - it returns the escaped string - it doesn't modify the source string. – John Parker Dec 27 '09 at 13:27
  • :S this is the very first time that im coding in php...a complete beginner and its just so confusing..any website/ebook that anyone can refer for quick and easy learning of how to make a dynamic website in php and mysql?? – rabeea Dec 27 '09 at 13:34
  • @rabeea Reading the first few chapters of the PHP Manual is a good start. Also try http://www.tuxradar.com/practicalphp and http://articles.sitepoint.com/category/php-tutorials – Gordon Dec 27 '09 at 13:47

2 Answers2

8

You're missing a closing parentheses:

if (isset($_POST['submit'])) {

but you have more worrying problems in that you're not sanitizing data before passing it to the database. Stop now! Didn't you read the comments on your earlier question?

Community
  • 1
  • 1
richsage
  • 26,912
  • 8
  • 58
  • 65
5

You are missing a closing paranthesis after if (isset($_POST['submit'])

It should read: if (isset($_POST['submit']))

Emil Vikström
  • 90,431
  • 16
  • 141
  • 175