Here is my form for adding the codes
Code: Select all
<center>
Add your dragons 4 digit code to the form<br>
<table>
<tr>
<td colspan=3>
<form method="post" action="add.php" >
Scrollname: <br>
<input type="text" name="Scrollname" size="40">
</td>
</tr>
<tr>
<td>
Egg Code:<br>
<input type="text" name="egg" size="4">
<td>
Hatchling Code:<br>
<input type="text" name="hatchling" size="4">
<td>
ER Code:<br>
<input type="text" name="er" size="4">
</td>
</tr>
<tr>
<td colspan=3>
<center><input type="submit" value="Submit">
</center>
</td>
</tr>
</table>
</form>Code: Select all
<?php
$Scrollname = $_POST['Scrollname'];
$egg = $_POST['egg'];
$hatchling = $_POST['hatchling'];
$er = $_POST['er'];
mysql_connect("localhost","","") or die ('Error: ' . mysql_error());
mysql_select_db("thehatch_dragons");
$query="INSERT INTO test (id, Scrollname, egg, hatchling, er)VALUES ('NULL', '".$Scrollname."', '".$egg."', '".$hatchling."', '".$er."')";
mysql_query($query) or die ('Error updating Database');
// Print out the contents of the entry
echo "<center>Dragons successfully added</center>";
?>