Support Forums

Full Version: $_POST array is empty
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
(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['']
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...
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.