-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>
4

2 回答 2

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?

于 2009-12-27T13:26:13.463 回答
5

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

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

于 2009-12-27T13:26:48.640 回答