Author Topic: *SOLVED* Information sent with form not appearing in POST.  (Read 784 times)

0 Members and 1 Guest are viewing this topic.

Offline VorotaevTopic starter

  • Enthusiast
  • Posts: 55
    • View Profile
    • http://
*SOLVED* Information sent with form not appearing in POST.
« on: April 01, 2006, 10:20:13 AM »
First the code in question (just a test case):

Code: [Select]
// This page is receive.php

<form action="receive.php" method="post">
    <input id="message" type="text" size="16" />
    <button type="submit">Submit</button>
</form>

<br /><br />

<?php

if(!$_POST == NULL) {
    echo ($_POST['message']);
}

?>

I've been having quite a bit of trouble with information being sent via form not ending up in the $_POST array. I tried simplifying the script as much as possible, thinking something else in the code was messing it up, but the above is about as barebones as I can make it and still doesn't work.

I'm running Apache 2.0.55 with PHP 5.1.2 on Windows XP Home SP2. It may be worthy of note that before upgrading Apache and PHP a few days ago (from 2.0.48 and 5.1.0 respectively), this problem didn't occur.
« Last Edit: April 01, 2006, 10:22:28 AM by Vorotaev »

Offline wildteen88

  • Guru
  • 'Insane!'
  • *
  • Posts: 12,021
  • Gender: Male
    • View Profile
*SOLVED* Information sent with form not appearing in POST.
« Reply #1 on: April 01, 2006, 10:23:51 AM »
change id="message" to name="message" and you should be fine.

Also chnage your PHP block to this:
Code: [Select]
<?php
if(isset($_POST['message']))
{
    echo $_POST['message'];
}
?>
« Last Edit: April 01, 2006, 10:25:34 AM by wildteen88 »

Offline VorotaevTopic starter

  • Enthusiast
  • Posts: 55
    • View Profile
    • http://
*SOLVED* Information sent with form not appearing in POST.
« Reply #2 on: April 01, 2006, 10:27:29 AM »
ASDFGHJKL;'.

Thank you very, very much. I knew it was something simple, but I just couldn't get it to work.

-EDIT-

Thanks, I'll use isset from herein. :)
« Last Edit: April 01, 2006, 10:28:07 AM by Vorotaev »