little help please

Discussion in 'PHP' started by barnes, Apr 30, 2007.

  1. #1
    register.html
    <body>
    <form action="register.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
    <table width="410" border="0" align="center" bordercolor="#99FFFF">
    <tr align="center" valign="middle">
    <td colspan="3"> <span class="style1">User Registration</span> </td>
    </tr>
    <tr>
    <td width="156" align="left"><div align="right" class="style4">UserName</div></td>
    <td width="22">:</td>
    <td width="218"><div align="left">
    <input name="username" type="text" name="username" />
    </div></td>
    </tr>
    <tr>
    <td><div align="right" class="style4">Password</div></td>
    <td>:</td>
    <td><label>
    <div align="left">
    <input name="passwrod" type="password" name="passwrod" />
    </div>
    </label></td>
    </tr>
    <tr>
    <td><div align="right" class="style4">E mail</div></td>
    <td>:</td>
    <td><label>
    <div align="left">
    <input type="text" name="email" />
    </div>
    </label></td>
    </tr>
    <tr>
    <td><div align="right" class="style4">Address</div></td>
    <td>:</td>
    <td><label>
    <div align="left">
    <textarea name="address"></textarea>
    </div>
    </label></td>
    </tr>
    <tr>
    <td><div align="right" class="style4">Country</div></td>
    <td>:</td>
    <td><label>
    <div align="left">
    <select name="country">
    <option>india</option>
    <option>usa</option>
    <option>pak</option>
    <option>england</option>
    <option>aus</option>
    <option>newzeland</option>
    <option>rsa</option>
    <option>srilanka</option>
    <option>west indies</option>
    </select>
    </div>
    </label></td>
    </tr>
    <tr>
    <td><div align="right" class="style4">City/Area</div></td>
    <td>:</td>
    <td><label>
    <div align="left">
    <select name="area" size="1" multiple="multiple" id="area">
    </select>
    </div>
    </label></td>
    </tr>
    <tr>
    <td><div align="right" class="style4">Pin Code </div></td>
    <td>:</td>
    <td><label>
    <div align="left">
    <input name="pin" type="text" id="pin" />
    </div>
    </label></td>
    </tr>
    <tr>
    <td><div align="right" class="style4">Phone Number </div></td>
    <td>:</td>
    <td><label>
    <div align="left">
    <input name="counrtycode" type="text" id="counrtycode" size="3" maxlength="3" />
    <input name="phoneno" type="text" id="phoneno" />
    </div>
    </label></td>
    </tr>
    <tr>
    <td><div align="left" class="style4">
    <div align="right">Upload Your Photo </div>
    </div></td>
    <td><div align="left">:</div></td>
    <td><label>

    <div align="left">
    <input type="file" name="file" />
    </div>
    </label></td>
    </tr>
    <tr>
    <td colspan="3"><label>
    <div align="center">
    <input type="submit" name="Submit" value="Submit" />
    </div>
    </label></td>
    </tr>
    </table>
    </form>
    </body>

    register.php

    <?php
    $con=mysql_connect("localhost","root","");
    mysql_select_db("user",$con);
    $username = $_post[username];
    $password = $_post[password];
    $email = $_post;
    $add = $_post[address];
    $contry=$_post[country];
    $area=$_post[area];
    $pin=$_post[pin];
    $countrycode=$_post[countrycode];
    $phoneno=$_post[phoneno];
    $file=$_post[file];
    $qry="INSERT INTO user1 (username,password,email,address,country,area,pincode,countrycode,phoneno,file) VALUES ('$username','$password','$email','$add','$contry','$area','$pin','$countrycode','$phoneno','$file')";
    mysql_query($qry,$con);
    mysql_close($con);
    ?>
    the following errors occured.how to fix these bugs.
    Notice: Use of undefined constant username - assumed 'username' in c:\easyphp1-8\www\register.php on line 10

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 10

    Notice: Use of undefined constant password - assumed 'password' in c:\easyphp1-8\www\register.php on line 11

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 11

    Notice: Use of undefined constant email - assumed 'email' in c:\easyphp1-8\www\register.php on line 12

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 12

    Notice: Use of undefined constant address - assumed 'address' in c:\easyphp1-8\www\register.php on line 13

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 13

    Notice: Use of undefined constant country - assumed 'country' in c:\easyphp1-8\www\register.php on line 14

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 14

    Notice: Use of undefined constant area - assumed 'area' in c:\easyphp1-8\www\register.php on line 15

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 15

    Notice: Use of undefined constant pin - assumed 'pin' in c:\easyphp1-8\www\register.php on line 16

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 16

    Notice: Use of undefined constant countrycode - assumed 'countrycode' in c:\easyphp1-8\www\register.php on line 17

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 17

    Notice: Use of undefined constant phoneno - assumed 'phoneno' in c:\easyphp1-8\www\register.php on line 18

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 18

    Notice: Use of undefined constant file - assumed 'file' in c:\easyphp1-8\www\register.php on line 19

    Notice: Undefined variable: _post in c:\easyphp1-8\www\register.php on line 19
     
    barnes, Apr 30, 2007 IP
  2. Subikar

    Subikar Active Member

    Messages:
    241
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #2
    $_post[username]; -> $_POST['username']; use this format you are using wrong format :)
     
    Subikar, Apr 30, 2007 IP