Jump to content

Recommended Posts

i have a HTML form to register users to my website, when i fill the form out however, the username and email are not send to the database...although the password is...below is the php code and ive enclosed the form as well as a screenshot of my database incase thats the problem, where am i going wrong! php is cracking my brains :(

 

thanks

rob

 

 

<?php
$con = mysql_connect("localhost","?????","??????");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("teamrend_rwowen", $con);

$sql="INSERT INTO Members (Username, Password, Email)
VALUES
('$_POST[username]','$_POST[Password]','$_POST[Email]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "Thank You, You are now a registered user";

mysql_close($con)
?> 

 

<form name="form2" method="post" action="registerphp.php">
      <td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBDBDB">
        <tr>
          <td colspan="3"><p align="center"><strong>Please Register </strong></p>
            <p> </p></td>
        </tr>
        <tr>
          <td width="78">Username </td>
          <td width="6">:</td>
          <td width="294"><input type="text" name="Username" id="Username"/></td>
        </tr>
        <tr>
          <td>Password</td>
          <td>:</td>
          <td><input type="text" name="Password" id="Password" /></td>
        </tr>
        <tr>
          <td>Email</td>
          <td>:</td>
          <td><input type="text" name="Email" id="Email" /></td>
        </tr>
        <tr>
          <td> </td>
          <td> </td>
          <td><input type="submit" name="Submit" value="Submit" /></td>
        </tr>
      </table></td>
    </form>

 

 

Here is my database set up[, and below is a screenshot of my attemps to register. the ID auto increments as normal, the username and email stays blank but for some reason password goes in just fine

 

 

dblayout.png

tablecontents.png

 

 

Link to comment
https://forums.phpfreaks.com/topic/198798-inserting-into-table/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.