hi all, i m new to php.
i hv copied some code and test.
"Record Inserted" returned, then i check the database, there is one row added, but all the values are null.
is there anything wrong with the script or with mysql?
anybody helps? thanks.
<?php
if ($_GET['post'] == "yes"
{
$dbuser = "XXX";
$dbserver = "localhost";
$dbpass = "XXX";
$dbname = "test_contri";
mysql_connect($dbserver)
or die ("UNABLE TO CONNECT TO DATABASE"
;
mysql_select_db($dbname)
or die ("UNABLE TO SELECT DATABASE"
;
$sql = "INSERT INTO user (
username, password, gname, wonid, email ) VALUES (
'$username', '$password', '$gname', '$wonid', '$email')";
if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }
$result = mysql_query($sql);
if ($result == 1) {
echo "Record Inserted";
} else {
echo "Error inserting record (9994SQL)";
}
}
if (!$_GET['post']) {
?>
<form method="post" action="<?php echo $thispage; ?>?proc=New&post=yes&<?php echo $pagevars; ?>">
<center>
<TABLE>
<TR>
<td>
<B>USERNAME:</B>
</td>
<td>
<textarea name="username" rows="4" cols="35"></textarea>
</TR>
<TR>
<td>
<B>PASSWORD:</B>
</td>
<td>
<input type="password" name="password" size="20">
</TR>
<TR>
<td>
<B>GNAME:</B>
</td>
<td>
<input type="gname" name="gname" size="20">
</TR>
<TR>
<td>
<B>WONID:</B>
</td>
<td>
<input type="wonid" name="wonid" size="20">
</TR>
<TR>
<td>
<B>EMAIL:</B>
</td>
<td>
<input type="email" name="email" size="20">
</TR>
<tr>
<td>
</td>
<td>
<input type="submit" value="Add Record" name="submit">
<input type="reset" value="Reset" name="reset">
</td>
</tr>
</table>
</center>
<BR>
</form>
<?php
}
?>
i hv copied some code and test.
"Record Inserted" returned, then i check the database, there is one row added, but all the values are null.
is there anything wrong with the script or with mysql?
anybody helps? thanks.
<?php
if ($_GET['post'] == "yes"
$dbuser = "XXX";
$dbserver = "localhost";
$dbpass = "XXX";
$dbname = "test_contri";
mysql_connect($dbserver)
or die ("UNABLE TO CONNECT TO DATABASE"
mysql_select_db($dbname)
or die ("UNABLE TO SELECT DATABASE"
$sql = "INSERT INTO user (
username, password, gname, wonid, email ) VALUES (
'$username', '$password', '$gname', '$wonid', '$email')";
if ($sql_debug_mode==1) { echo "<BR>SQL: $sql<BR>"; }
$result = mysql_query($sql);
if ($result == 1) {
echo "Record Inserted";
} else {
echo "Error inserting record (9994SQL)";
}
}
if (!$_GET['post']) {
?>
<form method="post" action="<?php echo $thispage; ?>?proc=New&post=yes&<?php echo $pagevars; ?>">
<center>
<TABLE>
<TR>
<td>
<B>USERNAME:</B>
</td>
<td>
<textarea name="username" rows="4" cols="35"></textarea>
</TR>
<TR>
<td>
<B>PASSWORD:</B>
</td>
<td>
<input type="password" name="password" size="20">
</TR>
<TR>
<td>
<B>GNAME:</B>
</td>
<td>
<input type="gname" name="gname" size="20">
</TR>
<TR>
<td>
<B>WONID:</B>
</td>
<td>
<input type="wonid" name="wonid" size="20">
</TR>
<TR>
<td>
<B>EMAIL:</B>
</td>
<td>
<input type="email" name="email" size="20">
</TR>
<tr>
<td>
</td>
<td>
<input type="submit" value="Add Record" name="submit">
<input type="reset" value="Reset" name="reset">
</td>
</tr>
</table>
</center>
<BR>
</form>
<?php
}
?>