I'm currently using this PHP Code for my form:
<?
include "../config.inc.php";
// Connect to server and select database.
$tbl_name = "pokemon";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("$username can't connect to mySQL database...");
// POST Data retrieved from form
$id=$_POST['id'];
$name=$_POST['name'];
$num=$_POST['num'];
$type1=$_POST['type1'];
$type2=$_POST['type2'];
$class=$_POST['class'];
$height=$_POST['height'];
$weight=$_POST['weight'];
$malerat=$_POST['malerat'];
$femalerat=$_POST['femalerat'];
$ability=$_POST['ability'];
$abilitydesc=$_POST['type1'];
$gen=$_POST['gen'];
$genlocation=$_POST['genlocation'];
$attack=$_POST['attack'];
$defense=$_POST['defense'];
$speed=$_POST['speed'];
$spattack=$_POST['spattack'];
$spdefense=$_POST['spdefense'];
$rbyloc=$_POST['rubyloc'];
$gscloc=$_POST['gscloc'];
$rseloc=$_POST['rseloc'];
$frlgloc=$_POST['frlgloc'];
$dploc=$_POST['dploc'];
$sql = "INSERT INTO $tbl_name(`id`, `name`, `num`, `type1`, `type2`, `class`, `height`, `weight`, `malerat`, `femalerat`, `ability`, `abilitydesc`, `gen`, `genlocation`, `hp`, `attack`, `defense`, `speed`, `spattack`, `spdefense`) VALUES (`$id`, `$name`, `$num`, `$type1`, `$type2' , '$class' , '$height' , '$weight' , '$malerat' , '$femalerat' , '$ability' , '$abilitydesc' , '$gen' , '$rbyloc' , '$gscloc' , '$rseloc' , '$frlgloc' , '$dploc' , '$hp' , '$attack' , '$defense', '$speed', '$spattack', '$spdefense')";
$result=mysql_query($sql);
if($result){
echo "<a href=\"http://www.pokeuniverse.info/pokemon/$id/\">$name</a> was added to the Pokedex!";
echo "<a href=\"valid.php\">Modify/Add Another Pokemon</a>";
}
else {
echo "Mistake while adding Pokemon. Go <a href=\"valid.php\">back</a> and try again.";
}
mysql_close();
?>
Then, after I submitted via the form, it gives me the error "Mistake while adding Pokemon". Is this some sort of syntax error with the SQL code? I can't seem to find the error.... Please help..