View Full Version : need help with this simple registration script please

10-12-2009, 01:08 PM
hi, i need some advice on this simple table updating registration script, it wont update the table with the new data. any help GREATLY appreciated. i tried to make it as simple as i could and i still cant find the error. thanks. derek

here is the code.


$full_name = $_POST['full_name'];
$username = $_POST['username'];
$password = $_POST['password'];
$maiden = $_POST['maiden'];
$color = $_POST['color'];

if($full_name && $username && $password && $maiden && $color){

mysql_query("INSERT INTO registration_table (full_name,username,password,maiden,color)VALUES(' $full_name','$username','$password','$maiden','$co lor')");


/// query db and loop through rows example
//selects everything from table and assigns to the variable $query

$query = mysql_query("SELECT * FROM registration_table");

$table = "<table width=\"40%\" border=\"1\">
<td>Here is your new registration information</td>


while($row = mysql_fetch_array($query)){ ////row now stands for the array fetched.

$table .= " <tr>



$table .= "</table>";

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

Please register to our forum below
<form id="form1" name="form1" method="post" action="registration.php">

<table width="31%" border="0">

<td>Full Name:</td>
<td><input name="full_name" type="text" id="full_name" /></td>
<td>User Name:</td>
<td><input name="username" type="text" id="username" /></td>
<td><input name="password" type="text" id="password" /></td>
<td>Mother's maiden name</td>
<td><input name="maiden" type="text" id="maiden" /></td>
<td>Your favorite color</td>
<td><input name="color" type="text" id="color" /></td>

<td><input type="submit" name="Submit" value="Submit" /></td>

10-12-2009, 01:27 PM
actually i edited the code so it updates the table, i also forgot to echo my table. now it echos it but it displays everyone's registration information the way its set up now. LOL. oh well. thank you. derek

10-13-2009, 12:37 AM
displays everyone's registration information the way its set up now
sounds like it needs a where clause in the select statement on the page where you echo the details