Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

mysql - users DB

Codes here !

Moderators: macek, egami, gesf

mysql - users DB

Postby php-punk » Wed Feb 26, 2003 3:58 am

i have recently started making a tutorials site for c++ and other things with a friend, i started with a create users code(create.php). theuser fills in a form and the results are POSTed to a .php file and entered to a db, the thing is, not everthing is entered to the db:

CODE:

Code: Select all
<?php

//connect to MYSQL
$connect=mysql_connect("localhost","***","***") or die ("sorry unable to connect(1)".mysql_error());

//select database
$DB=mysql_select_db(tut_site, $connect) or die ("sorry unable to select DB".mysql_error());


//setting-up query
$query="INSERT INTO `users` (`id`, `user`, `password`, `email`, `website`, `joined`, `age`, `interests`, `desc`) VALUES ('', '$_POST[user]', '$_post[password]', '$_POST[email]', '$_POST[website]', '', '$_POST[age]', '$_post[interests]', '$_post[desc]')";
                  
//sending query to server, if error, MYSQL will break out of query and send error to browser
mysql_query($query) or die ("Sorry unable to connect(2)".mysql_error());

//informing user of success
echo("Your user:<b>$_POST[user]</b>, was created");
?>


HTML Form

Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Create New User</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body text="#FF0000">
<p><font face="Arial Black, Comic Sans MS">Please fill in the below from and your
  account will be created:</font></p>
<p><font face="Arial, Helvetica, sans-serif">All fields mark with a * <strong>must</strong>
  be filled in </font></p>
<form name="Create User" method="post" action="create.php">
  <p>&</p>
  <table width="75%" height="343" border="0" cellspacing="2">
    <tr>
      <td width="18%">User Name:*</td>
      <td width="82%"><input type="text" name="username"></td>
    </tr>
    <tr>
      <td>Password: *</td>
      <td><input type="text" name="password"></td>
    </tr>
    <tr>
      <td>Website</td>
      <td><input type="text" name="website"></td>
    </tr>
    <tr>
      <td>Age</td>
      <td><input type="text" name="age"></td>
    </tr>
    <tr>
      <td>Interests</td>
      <td><input type="text" name="interests"></td>
    </tr>
    <tr>
      <td>Description</td>
      <td><textarea name="desc" cols="50" rows="10"></textarea></td>
    </tr>
  </table>
  <table width="75%" border="0" cellspacing="2">
  </table>
  <p>
    <input name="Submit" type="submit"  value="Create">
  </p>
  <p>&</p>
</form>
<p>&</p>
</body>
</html>


cany anybody help, as i cant see a problem
php-punk
New php-forum User
New php-forum User
 
Posts: 60
Joined: Sun Feb 02, 2003 2:10 am
Location: Leeds, Uk

Postby Romantik » Wed Feb 26, 2003 4:40 am

Use $_POST["..."];
Don't use $_post["..."]
Romantik
New php-forum User
New php-forum User
 
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson


Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.