Omair Arif Omair Arif - 5 months ago 13
PHP Question

HTML form not sending data via $_POST

Ive been trying to send some basic form information from my index page to a .php page. Ive tweaked my code looking at the previously asked questions but to no avail. I have another form on the same page which sends information to another .php page which works without flaw.

My form page code:

<form name="login" action="login.php" method="post">
<p>email: <input type="text" name="loginEmail"></p><br>
<p>password: <input type="password" name="loginPass"></p>
<button type="submit"> Submit!</button>
</form>


my login.php page code:

<?php
echo "test";
$email=$POST_["loginEmail"];
echo $email;
?>


All I see on my login.php page is "test".
Thanks.

Answer

Switching the location of the _ should do it:

<?php
echo "test";
$email=$_POST["loginEmail"];
echo $email;
?>