0

Either I am incredibly stupid or something is wrong with my dev environment. Ive been pulling my hair out of my head for these past few days as my form $_POST variables are simply not getting passed.

So I have scalled it down to the most simplest of tests, just to ensure there is nothing wrong with my script, which I originally thought, which took up all my time trying to find a bug which isnt there. I tried the following and then realise it is a case where $_POST values arent getting passed

<form method="POST" name="login" action="test.php" id="loginForm">
    <input type="text" name="email" placeholder="please enter email">
    <input type="text" name="password" placeholder="please enter your password">
    <button type="submit" name="submitBtn">SUBMIT</button>
</form>

test.php

var_dump($_POST);
$_POST['email'];
$_POST['password'];

I am hoping to get some possible solutions or advise on what I can try to further debug this.

I am using XAMPP, and PHPStorm.

var_dump($_POST) results in NULL{}

14
  • "email" is not a valid type attribute according to Mozilla. type is not the name, email would be type=text - developer.mozilla.org/en-US/docs/Web/HTML/Element/input Commented Mar 11, 2018 at 4:54
  • Hi just changed it to text now, as I have tried it with text, same result Commented Mar 11, 2018 at 4:55
  • How are you accessing this in your browser? URL (such as http://localhost/test.php) or file (such as /home/folder/test.php)? Commented Mar 11, 2018 at 4:55
  • http://localhost/FOLDER/test.php Commented Mar 11, 2018 at 4:56
  • Sounds like something could be wrong with your dev environment, possibly PHP config issues. What if you switch to method="GET" and var_dump($_GET)? Commented Mar 11, 2018 at 4:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.