Trying to learn - what am I doing wrong

HI guys,

I’m trying to learn PHP by starting with the headfirst book, and I’m having problems replicating the example in the first chapter. Can someone help me figure out what im doing wrong?Looks like I have everything typed exactly and still not getting the expected results with echoing a couple of variables And as I’m sure I’m going to run into this type of problem, how do i figure out for myself what I’m doing wrong?

Basically I’m just trying to echo data from an html form:

here’s my html form

 <form method="post" action="report.php">
    <label for="firstname">First name:</label>
    <input type="text" id="firstname" name="firstname" /><br />
    <label for="lastname">Last name:</label>
    <input type="text" id="lastname" name="lastname" /><br />
    <label for="email">What is your email address?</label>
    <input type="text" id="email" name="email" /><br />
    <label for="whenithappened">When did it happen?</label>
    <input type="text" id="whenithappened" name="whenithappened" /><br />
    <label for="howlong">How long were you gone?</label>
    <input type="text" id="howlong" name="howlong" /><br />
    <label for="howmany">How many did you see?</label>
    <input type="text" id="howmany" name="howmany" /><br />
    <label for="aliendescription">Describe them:</label>
    <input type="text" id="aliendescription" name="aliendescription" size="32" /><br />
    <label for="whattheydid">What did they do to you?</label>
    <input type="text" id="whattheydid" name="whattheydid" size="32" /><br />
    <label for="fangspotted">Have you seen my dog Fang?</label>
    Yes <input id="fangspotted" name="fangspotted" type="radio" value="yes" />
    No <input id="fangspotted" name="fangspotted" type="radio" value="no" /><br />
    <img src="fang.jpg" width="100" height="175"
      alt="My abducted dog Fang." /><br />
    <label for="other">Anything else you want to add?</label>
    <textarea id="other" name="other"></textarea><br />
    <input type="submit" value="Report Abduction" name="submit" />
  </form>

here’s the relevant php

<?php
	$when_it_happened = $_POST['whenithappened'];
	$how_long = $_POST['howlong'];
	$alien_description = $_POST['aliendescription'];
	$fang_spotted = $_POST['fangspotted'];
	$email = $_POST['email'];
	$what_they_did = $_Post['whattheydid'];
	$anything_else = $_Post['other'];
		
	echo 'Thanks for submitting the form.<br />';
	echo 'You were abducted ' . $when_it_happened;
	echo ' and were gone for ' . $how_long . '<br />';
	echo 'Describe them: ' . $alien_description . '<br />';
	echo 'Was Fang there? ' . $fang_spotted . '<br />';
	echo 'The aliens did this: ' . $what_they_did . '<br />';
	echo 'anything else? ' . $anything_else . '<br /)';
	echo 'Your email address is ' . $email;
	

		
	?>

i cant for the life of me figure out why this isnt displaying the data for $what_they_did and $anything_else

Would really appreciate your comments.

Thanks

that’s great, exactly what i was looking for …even downloaded firephp to try it

found the answer…was using $_Post instead of $_POST for the variables in question…

Put these few lines of debug at the top of report.php


<?php

if( isset($_POST)){

var_dump($_POST);

}