Whenever i try to use a form to post data to PHP, It says it cant find any variables, it seems no information is going through the post. For example i try to get the variable "color" which is a drop down list, but it says undefined. Here is my HtML
<form name="myform" action="index.php" method="post" >
<p>Body: <select id="body"name="body" onchange='changeLevel()'list="body">
<option value="Snail">Snail</option>
<option value="Ghost">Ghost</option>
</select></p>
<p>Color: <select name="color" list="colors">
<option value="Red">Red</option>
<option value="Green">Green</option>
<option value="Blue">Blue</option>
</select></p>
<p>Boots? <select name="boots"list="boots" >
<option>yes</option>
<option>no</option>
</select> </p>
<p id="mouthtext">Mouth: <select name="mouth" list="mouths" >
<option id="mouth1" value="Happy">Happy</option>
<option id="mouth2" value="Scared">Scared</option>
<option id="mouth3"value="Sad">Sad</option>
</select></p>
<p id="eyestext">Eyes: <select name="eyes" list="eyes">
<option id="eyes1"value="Angry">Angry</option>
<option id="eyes2"value="Excited">Excited</option>
<option id="eyes3"value="Tired">Tired</option>
<option id="eyes4"value="Dead">Dead</option>
<option id="eyes5"value="PinPoint">Pin Point</option>
</select></p>
<p id="tattootext">Tattoo: <select name="Tattoos"list="tattoos">
<option id="tattoo1"value="Fire">Racing Fire</option>
<option id="tattoo2"value="Mom">Mom</option>
<option id="tattoo3"value="Scales">Scaley</option>
<option id="tattoo4"value="Slimy">Slimy</option>
<option id="tattoo5"value="Snail">Snail</option>
</select></p>
<p>Name:
<input type="text" name="name" size="20" maxlength="30" autofocus="autofocus" ></p>
<script type="text/javascript">
function changeLevel(){
if(document.getElementById("body").value == "Snail"){
document.getElementById("mouthtext").style.display = "none";
document.getElementById("eyestext").style.display = "none";
document.getElementById("tattootext").style.display = "inline";
}
else{
document.getElementById("mouthtext").style.display = "inline";
document.getElementById("eyestext").style.display = "block";
document.getElementById("tattootext").style.display = "none";
}
}
changeLevel()
</script>
<input type="submit" name="submit" value="Make my character!"/>
</form>
AND I HAVE THIS PHP right below it which should simply print out the color chosen, but does not
<?
if (isset($_POST['myform'])){
$color = $_POST['color'];
?><?= $color;?><?}
?>
When i load the page it says 'color' is undefined variable, even though i definitely have a name equal to 'color'. Why cant i load any posts?