Renlok Posted December 25, 2006 Share Posted December 25, 2006 ive made a character creation page for a thing im "tying to create" but i doesnt insert the id of the charater type.heres the codesmembers.php part:[code] <form name="pets" method="post" action="http://www.we-link.co.uk/roe/adopt.php">'; $roequery = mysql_query("SELECT * FROM roetypes"); $roetypeheader = "<table width=\"250\" border=\"0\">"; while($roetype = mysql_fetch_array($roequery)) { $image = $roetype['image']; $name = $roetype['name']; $roetypemain .=<<<EOD <tr> <td><img src="http://we-link.co.uk/roe/images/$image" alt="$name"></td> <td><label> <input type="radio" name="RadioGroup1" value="$name"> $name</label> </td> </tr>EOD; } $roetypefooter = "</table>"; $roetypetable =<<<ROE $roetypeheader $roetypemain $roetypefooterROE; echo $roetypetable; echo '<input type="submit" name="Submit" value="Adopt"></form>';[/code]adopt.php[code]$pet = $_POST['RadioGroup1'];echo '<center>You have chosen '.$pet;$petquery = mysql_query("SELECT * FROM roetypes WHERE name='$pet'");$petdata = mysql_fetch_array($petquery);$image = $petdata['image'];echo "<br><img src=\"http://we-link.co.uk/roe/images/$image\" alt=\"$pet\"><p>";$naming =<<<EOD <form name="adoptpet1" method="post" action="http://www.we-link.co.uk/roe/adopt2.php"> <p> <input type="hidden" name="pettype" value="$pet"> <label> <input type="text" name="petname"> </label> </p> <input type="submit" name="Submit" value="Accept Name"> </form>EOD;echo "<p>Name your new $pet<br>$naming </center>";[/code]adopt2.php[code]$pettype = $_POST['pettype'];$petname = $_POST['petname'];$idquery = mysql_query("SELECT * FROM roetypes WHERE name='$pettype'");$idresult = mysql_fetch_array($idquery);echo "<center>Congratulations you now have you very own $pet named $petname<br><a href=\"http://www.we-link.co.uk/roe/members.php\">continue to your roe page.</a></center>";$petquery = mysql_query("INSERT into roe (roename, userid, type) values ('$petname', '$username', '$idresult')");[/code]thanks for any help, and merry christmas. Link to comment https://forums.phpfreaks.com/topic/31786-php-problems/ Share on other sites More sharing options...
onlyican Posted December 25, 2006 Share Posted December 25, 2006 Merry ChristmasDont work too hard on this today, afterall, it is Christmas Day (I am in the UK)But anywayTry using a Manual Debug SystemFirst of all, at the top of your script add this line of codeerror_reporting(2047);then thoughout your scriptecho little notes to yourselfFor Exampleecho "ID is ".$id."<br />\n";And find out when the $id value is emptyWhen you find out where it is empty, it is easier to find out whyAlsoWith using the error_reporting(2047) it will say"Undified variable"If you have that, then you might have a typo somewhere, which is storing the variable value else where. Link to comment https://forums.phpfreaks.com/topic/31786-php-problems/#findComment-147489 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.