Hello, all. I have this piece of code to allow me to add data via from to my database. However, it doesn't work for me at all and so i would appreicate if anyone can point me the errors, as i new to this
Code:
<?
if (!isset($submit)):
?>
<html>
<head><title>New Game Entry</title>
<link rel="stylesheet" href="http://www.xplodercodes.com/xiccc.css" type="text/css">
</head>
<body bgcolor="#000000" text="#ffffff" link="#00ff00" vlink="#c0d9d9" alink="#ffffff">
<h3>New Game Entry</h3><p>
<form method=post action="<?=$PHP_SELF?>">
<center>
<table border=0 cellpadding=0 cellspacing=5>
<tr><td align=right>Alpha</td>
<td><input name=Alpha type=text maxlength=100 size=25>
</td>
</tr>
<tr><td align=right>Game</td>
<td><input name=Game type=text maxlength=100 size=25> </td>
</tr>
<tr>
<td align=right>Publisher</td>
<td><input name=Publisher type=text maxlength=100 size=25></td>
</tr>
<tr><td align=right>Developer</td>
<td><input name=Developer type=text maxlength=100 size=25></td>
</tr>
<tr><td align=right colspan=2>
<input type=reset value="Reset Form">
<input type=submit name=”submit” value="Submit">
</td>
</tr>
</table>
</form>
</center>
</body>
</html>
<?php
else:
$dbhost = "localhost";
$dbuser = "xiccc";
$dbpass = "******";
$dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass)
or die("The database appears to be down.");
if ($db!="" and !@mysql_select_db($db))
die("The site database is unavailable.");
return $dbcnx;
if ($Alpha=="" or $Game=="" or $Publisher=="" or $Developer=="") {
error("One or more required fields were left blank.\\n".
"Please fill them in and try again.");
}
$sql = "INSERT INTO PlaystationRpg SET
Alpha = '$Alpha',
Game = '$Game',
Publisher = '$Publisher',
Developer = '$Developer'";
if (!mysql_query($sql)) {
error("A database error occurred in processing your submission.");
}
?>
<html>
<head><title> Adding Complete </title></head>
<body>
<p>Entry Successfully Added!
</body>
</html>
<?php
endif;
?>








Bookmarks