Page 1 of 1

little help please

Posted: Mon Apr 30, 2007 11:10 pm
by barnes529
Jcart | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


register.html
[syntax="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[/syntax]

Code: Select all

$con=mysql_connect("localhost","root","");
 mysql_select_db("user",$con);
  $username = $_post[username];
  $password = $_post[password];
  $email = $_post[email];
  $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


Jcart | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Apr 30, 2007 11:39 pm
by barnes529
Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


i modified this register.php into

Code: Select all

<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("user",$con);
  $username = mysql_real_escape_string($_POST['username']);
  $password = mysql_real_escape_string($_POST['password']);
  $email = mysql_real_escape_string($_POST['email']);
  $add = mysql_real_escape_string($_POST['address']);
  $contry=mysql_real_escape_string($_POST['country']);
  $area=mysql_real_escape_string($_POST['area']);
  $pin=mysql_real_escape_string($_POST['pin']);
  $countrycode=mysql_real_escape_string($_POST['countrycode']);
  $phoneno=mysql_real_escape_string($_POST['phoneno']);
  $file=mysql_real_escape_string($_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);
  ?>
again i am getting following errors:

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

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

Notice: Undefined index: file in c:\easyphp1-8\www\register.php on line 19


Weirdan | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Tue May 01, 2007 2:31 am
by dibyendrah
You must use $_POST not $_post. Variable name are case sensitive.