Support Forums
$_POST array is empty - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: PHP The Hypertext Preprocessor (https://www.supportforums.net/forumdisplay.php?fid=21)
+---- Thread: $_POST array is empty (/showthread.php?tid=7496)



$_POST array is empty - RPicard - 05-31-2010

Hey everyone, haven't posted here in a while but I'm having an issue with PHP and figured this would be a good place to go.

I'm working on a custom script, specifically the messaging system, and I have the form to submit the message -

Code:
<form action="inc/msg/send.php" method="post">
    <label>To:
        <input type="text" name="to"></input>
    </label><br><br>
    <label>Subject:
        <input type="text" name="subject"></input>
    </label><br><br>
    <label>Message:
        <textarea name="message"></textarea></input>
    </label><br><br>
    <input type="submit"></input>
</form>

- but when I access the $_POST array, the value for any array item is " ". It can be accessed via -

PHP Code:
$data file_get_contents('php://input'); 

- though. Any ideas on what might be causing this?


RE: $_POST array is empty - Buffy - 05-31-2010

(05-31-2010, 11:36 AM)RPicard Wrote: Hey everyone, haven't posted here in a while but I'm having an issue with PHP and figured this would be a good place to go.

I'm working on a custom script, specifically the messaging system, and I have the form to submit the message -

Code:
<form action="inc/msg/send.php" method="post">
    <label>To:
        <input type="text" name="to"></input>
    </label><br><br>
    <label>Subject:
        <input type="text" name="subject"></input>
    </label><br><br>
    <label>Message:
        <textarea name="message"></textarea></input>
    </label><br><br>
    <input type="submit"></input>
</form>

- but when I access the $_POST array, the value for any array item is " ". It can be accessed via -

PHP Code:
$data file_get_contents('php://input'); 

- though. Any ideas on what might be causing this?

I have literally never seen that file_get_contents method for returning a value. You're better off using $data = $_POST['']


RE: $_POST array is empty - MattR - 05-31-2010

I don't know why you're doing it that way, I too have never seen that used in any code. Just literally use $_POST...


RE: $_POST array is empty - RPicard - 05-31-2010

I am using $_POST, I just mentioned file_get_contents to show that the information is being passed. I actually got this fixed. There was an error with the function in another part of the process.

Thanks for responding.