DTYlan DTYlan - 1 year ago 85
PHP Question

Isset still not doing its job

I've seen this issue all over stack overflow but none of the methods helped.


<form action="login.php" method="POST">
<input name="username" type="text" placeholder="User Name">
<input name="rawpassword" type="password" placeholder="Password">
<input value="Login" type="submit">


// Gets user entered details from form.
if (isset($_POST['username'])) {
} else {
if (isset($_POST['rawpassword'])) {
} else {

// Hashes password through SHA-1.
$password = sha1($rawpassword);

echo "$username";
echo "$rawpassword";
echo "$password";

My problem is that the

if (isset($_POST['']))

is coming back as false and will make both variables null and echos null (nothing). But if I was to do this:

if (!isset($_POST['']))

It returns the undefined index error that everyone gets.

Help will be much appricated.

Answer Source

I have fixed the issue that I was having, obviously I didn't do enough research to find out that the problem was that JQuerymobile (should have mentioned that I was using JQuerymobile) has it's own special ways of requesting pages.

All I needed to do was add data-ajax="false" into the <form> tag, now everything works how I wanted it to work.

Thank you everyone for your suggestions and help.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download