[PHP] Blank Response On POST

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
Hello,

So I'm trying to POST some data to page B via page A.
The problem is, when I GET page B, it works fine... however, when POSTing to page B via page A, I get a blank response (sometimes NO DATA RECEIVED).

Can anyone help me with this?

Thanks.
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
PHP:
//A.PHP
<form action="b.php" method="POST">
    <input type="text" name="username" placeholder="Username..." />
    <input type="text" name="password" placeholder="Password..." />
</form>
//B.PHP
<?php
    if(isset($_POST['username']) && isset($_POST['password'])){
        echo "Hello, " . $_POST['username'];
    }
 

NSA

sudo apt-get thefuckout.tar.gz
Dec 9, 2011
715
86
There's nothing in the developer console.
I get a response from the server when running the page without a POST parameter, it's just when $_POST is set.

I need to use POST, apparently GET isn't an option.
Seems strange that this would happen only when POSTing though, perhaps it's an issue with my hosting provider?
 

Kaz

BooYah
Staff member
Nov 16, 2010
3,064
1,025
add a submit to your A
<input type="submit" name="test" value="submit">

Then on B
if(isset($_POST['test'])) {
echo "Hello, " . $_POST['username'];
}

Tried that? Or do you not want a submit?
 

Kaz

BooYah
Staff member
Nov 16, 2010
3,064
1,025
Yeah, sorry I've tried that.
I just got frustrated and tried different things. :/

I just set it up locally and mine works fine :s

A.php
HTML:
<form action="b.php" method="POST">
    <input type="text" name="username" placeholder="Username..." />
    <input type="text" name="password" placeholder="Password..." />
    <input type="submit" name="test" value="submit" />
</form>

B.php
PHP:
<?php
    if(isset($_POST['test'])){
        echo "Hello, " . $_POST['username'];
    }
?>
 

Users who are viewing this thread

Top