0

Before hand im going to say "THIS IS NOT A DUPLICATE" I have used isset, BUT it should be set no matter what! The form will not work unless it's set "required"

I have searched for the answer to this and i know i can check for isset but that's not the problem. My problem is the $_POST variable is definatly being set, it's just not going through for some reason. Here is my code:

I'm going to shorten it just so it can be read easily:

<form method='POST' action="php/account-scripts/register-request.php">

<strong>Email Address:</strong><small>Only email addresses ending in ".co.uk" or ".com" are accepted.</small><br/>
<input type='email' name='register-account-email' required><br/><br/>

<input type='submit' value='Login'><br/>

and the register-request (Shortened):

    if (isset($_POST['register-account-email']))
{
    $r_email = $_POST['register-account-email'];
}

There should always be a $_POST set for register-account-email but i type it in and it just wont go through? Any ideas?

Error is: ...PHP Notice: Undefined index: register-account-email... ...line 8

SOLVED

I removed the form action="", ran it, then replaced the action attribute. Worked fine after that. Very strange bug.

  • Could you post some more code? – sridesmet May 15 '14 at 14:49
  • That is all the code related to the problem the rest is all checking for username files and password matches and some other form inputs... I will place the rest at the bottom. – Eddygeek18 May 15 '14 at 14:51
  • Could you just try `if(isset($_SESSION["register-account-email"])) echo "error";` Put it on top of your register-request.php file. This way we can verify if your post-variable gets thru. – sridesmet May 15 '14 at 15:04
  • This piece of code could come in handy too: `' . print_r($_SESSION, true) . ''; ?>` It shows the whole $_SESSION array. – sridesmet May 15 '14 at 15:07
  • 1
    I have already done that aswell as like 5 different other error checks. I fixed it now it was a bug with php not my script. I removed the action attribute from the form, submitted it, replaced the action attribute, then it just worked fine. Not a clue what happend. – Eddygeek18 May 15 '14 at 15:07
  • Also $_SESSION was working fine, it was just that one $_POST['register-account-email'] and it's $_POST which messed up not $_SESSION but thanks alot for the help anyway :) – Eddygeek18 May 15 '14 at 15:08
  • Ow crap, it should indeed be $_POST instead of $_SESSION in my comments above. I guess I'm a bit tired ;-) Could you answer your own question and mark it as solved? – sridesmet May 15 '14 at 15:12

0 Answers0