...

View Full Version : $_post not working



rafiki
08-30-2006, 07:00 PM
:confused:

heres my form.php code

<BR><BR><BR><BR><form action="welcome.php" method="post" />
First Name: <input type="text" name="firstname" /><br />
Surname: <input type="text" name="surname" /><br />
DOB: <input type="text" name="DOB" /><br />
Year In School:
<select name="school_year" />
<option value="7" />7
<option value="8" />8
<option value="9" />9
<option value="10" />10
<option value="11" />11
</select />,<br />
Number of Siblings: <input type="text" name="siblings" /><br />
Bedtime: <select name="bedtime" /><br />
<option value="7" />7
<option value="8" />8
<option value="9" />9
<option value="10" />10
<option value="11" />11
<option value="other" />other
</select /><br />
Time Doing Home Work: <input type="text" name="homework" /><br />
Time watching T.V: <input type="text" name="tv" /><br />
Time Playing Computer/console: <input type="text" name="computer" /><br />
Time Spent With Family: <input type="text" name="family" /><br />
Time Spent With Friends: <input type="text" name="friends" /><br />
<input type="submit" />
</form />


and here is my welcome.php


<?php
echo "Welcome $_POST['firstname'] thanks for filling in out form";
?>

googleit
08-30-2006, 07:03 PM
use
$_Get['firstname']

Fumigator
08-30-2006, 07:07 PM
You're closing your form before it has a chance to live.


<form action="welcome.php" method="post" />

See anything funky about that?

I'll give you a hint.. "<form />" is shorthand for "<form></form>".

You've got similar issues on your <select> tags. And </select /> is... interesting philosophically (how does one close a closer tag?), but wrong :)

marek_mar
08-30-2006, 07:19 PM
You can't do it like this:


<?php
echo "Welcome $_POST['firstname'] thanks for filling in out form";
?>

You either have to use complex syntax (it's not really complex, it's just a name)


<?php
echo "Welcome {$_POST['firstname']} thanks for filling in out form";
?>

or concatenate


<?php
echo 'Welcome ' . $_POST['firstname'] . ' thanks for filling in out form';
?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum