Php 用户注册

Php 用户注册,php,registration,Php,Registration,嘿,这是我的用户登记表register\u hiler.phpin,我试图输入员工的详细信息,但它不起作用。它在后面的第行给出了一个解析错误:if isset$_POST['submit'],它只是有一个{ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>The Freelance World</title> &l

嘿,这是我的用户登记表register\u hiler.phpin,我试图输入员工的详细信息,但它不起作用。它在后面的第行给出了一个解析错误:if isset$_POST['submit'],它只是有一个{

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

您缺少一个右括号:


但您有更令人担忧的问题,因为在将数据传递到数据库之前,您没有对其进行清理。现在停止!您没有阅读有关的评论吗?

如果设置为$\u POST['submit',您将丢失一篇结束语


它应该是这样的:如果isset$\u POST['submit']

您还错误地使用了mysql\u real\u escape\u字符串-它返回了转义字符串-它没有修改源字符串。:S这是我第一次用php编写代码……一个完全的初学者,而且非常混乱。任何人都可以参考任何网站/电子书来快速轻松地学习如何用php和mysql创建动态网站??@rabeea阅读PHP手册的前几章是一个很好的开始。同时尝试
if (isset($_POST['submit'])) {