Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP isset function for submit check not working
    primarykey
    data
    text
    <p>I have just discovered that the isset function is no longer working on my login and register forms. Very strange I though, so I undid everything that I had recently done to see if it was causing it but no luck. If i remove the isset and replace with this;</p> <pre><code>if($_SERVER['REQUEST_METHOD'] == "POST"){ </code></pre> <p>it works! But I have two forms on one page so I need to check which one is submitted.</p> <p>Here's the isset function:</p> <pre><code>if (isset($_POST['submit_login'])) { </code></pre> <p>And the submit button just so you know it has the correct name;</p> <pre><code>&lt;input type="submit" name="submit_login" value="Login" class="buttonClassic"/&gt; </code></pre> <p>The one for the register form is exactly the same but with name <code>submit_reg</code>.</p> <p>Form:</p> <pre><code>&lt;form action="&lt;?php echo htmlentities('Login'); ?&gt;" method="post" id="login"&gt; &lt;p class="p1"&gt;Already signed up? Log in&lt;/p&gt;&lt;hr/&gt; &lt;label for="email"&gt;Your email address &lt;/label&gt;&lt;input type="email" required name="email" placeholder="Email" class="text" id="email"&gt; &lt;label for="password"&gt;Your password &lt;/label&gt;&lt;input type="password" name="pass" required placeholder="Password" class="text" id="password"&gt; &lt;center&gt;&lt;input type="submit" name="submit_login" value="Login" class="buttonClassic"/&gt;&lt;/center&gt; &lt;div class="center-align-text"&gt; &lt;p class="p3"&gt;&lt;a href="passreset.html"&gt;Forgotten your password?&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>reg form:</p> <pre><code>&lt;form action="&lt;?php echo htmlentities('Login'); ?&gt;" method="post" id="register" &gt; &lt;p class="p1"&gt;New to NBS? Sign up, it's free!&lt;/p&gt;&lt;hr/&gt; &lt;label for="reg_email"&gt;What's your email address? &lt;/label&gt;&lt;input type="email" name="email" required placeholder="Email" class="text" id="reg_email"&gt; &lt;label for="reg_password"&gt;Choose a password &lt;/label&gt;&lt;input type="password" required name="pass" placeholder="Password" class="text" id="reg_password"&gt; &lt;label for="reg_password2"&gt;Re-type password &lt;/label&gt;&lt;input type="password" required name="pass2" placeholder="Re-type password" class="text" id="reg_password2"&gt; &lt;input type="checkbox" name="subscribed" value="subscribed" id="subscribed"&gt;&lt;label for="subscribed"&gt;Yes, send me email updates from NewBorn Sounds. &lt;/label&gt; &lt;br/&gt; &lt;input type="checkbox" required="flag" name="terms" value="ticked" id="terms"&gt;&lt;label for="terms"&gt;I agree to the &lt;a href="Terms"&gt;terms &amp; conditions&lt;/a&gt;.&lt;/label&gt; &lt;center&gt;&lt;input type="submit" name="submit_reg" value="Sign Up" class="buttonClassic"&gt;&lt;/center&gt; &lt;/form&gt; </code></pre> <p>If you need anything more just shout!</p> <p>Oh and I know I could just submit the form to an external PHP script but I don't particularly want to do that as I would like the user input errors to be outputted to the same page. I know I could just use ajax, which I do, but I am trying to keep javascript as an add-on and not reduce the user experience for no js.</p> <p>Full HTML:</p> <pre><code>&lt;div id="login_form_wrapper"&gt; &lt;form action="Login" method="post" id="login" novalidate="novalidate"&gt; &lt;p class="p1"&gt;Already signed up? Log in&lt;/p&gt;&lt;hr&gt; &lt;label for="email"&gt;Your email address &lt;/label&gt;&lt;input type="email" required="" name="email" placeholder="Email" class="text" id="email"&gt; &lt;label for="password"&gt;Your password &lt;/label&gt;&lt;input type="password" name="pass" required="" placeholder="Password" class="text" id="password"&gt; &lt;center&gt;&lt;input type="submit" name="submit_login" value="Login" class="buttonClassic"&gt;&lt;/center&gt; &lt;div class="center-align-text"&gt; &lt;p class="p3"&gt;&lt;a href="passreset.html"&gt;Forgotten your password?&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; &lt;/form&gt; &lt;form action="Login" method="post" id="register" novalidate="novalidate"&gt; &lt;p class="p1"&gt;New to NBS? Sign up, it's free!&lt;/p&gt;&lt;hr&gt; &lt;label for="reg_email"&gt;What's your email address? &lt;/label&gt;&lt;input type="email" name="email" required="" placeholder="Email" class="text" id="reg_email"&gt; &lt;label for="reg_password"&gt;Choose a password &lt;/label&gt;&lt;input type="password" required="" name="pass" placeholder="Password" class="text" id="reg_password"&gt; &lt;label for="reg_password2"&gt;Re-type password &lt;/label&gt;&lt;input type="password" required="" name="pass2" placeholder="Re-type password" class="text" id="reg_password2"&gt; &lt;input type="checkbox" name="subscribed" value="subscribed" id="subscribed"&gt;&lt;label for="subscribed"&gt;Yes, send me email updates from NewBorn Sounds. &lt;/label&gt; &lt;br&gt; &lt;input type="checkbox" required="flag" name="terms" value="ticked" id="terms"&gt;&lt;label for="terms"&gt;I agree to the &lt;a href="Terms"&gt;terms &amp;amp; conditions&lt;/a&gt;.&lt;/label&gt; &lt;center&gt;&lt;input type="submit" name="submit_reg" value="Sign Up" class="buttonClassic"&gt;&lt;/center&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload