There is a form of type:

<form method="POST" action="<? echo $_SERVER['PHP_SELF']; ?>"class="cd-form"> <p class="fieldset"> <input class="full-width has-padding" id="auth" type="submit" value="Create account"> </p> </form> 

Based on this code:

 <?if(isset($_POST['auth'])) { echo 'Yes'; } else { echo 'No';} ?> 

The button with the auth identifier, when clicked, should display the value: Yes , but it is not, why? and how to fix?

The registration / authorization form is taken from here: https://codyhouse.co/gem/loginsignup-modal-window/

    2 answers 2

    You check the [auth] variable, but it is not passed from the form. Specify name , for input

    UPDATE

     <form method = "POST" action = "reg.php"> <input type = "hidden" name = "auth" value = "VALUE"> <input type = "submit" value = "Create"> </form> 
    • I indicated, all the same displays the value: No <input class="full-width has-padding" name="auth" type="submit" value="Create account"> And if I create it via <button name="auth">Submit<button> then the POST request is being processed - Vasily Gilbert
    • @ VasiliyGilbert, see added to my post a small example of how the form should look like, in my case when you click on the send input, the reg.php file results in the POST [auth] variable, which is set to '' Value ' - Yevgeny Ignatyev
    • if I don’t specify a class, all styles disappear. And it’s good, but not exactly what I need :) - Vasily Gilbert
    • @ VasiliyGilbert, yes, the class can be specified without problems, I just threw it as a small example. In this key, classes in no way affect the functionality - Yevgeny Ignatyev
    1. The action field can be left empty, the file will execute itself.
    2. $ _POST ['auth'] refers to the name attribute and not the id.
    • I indicated, all the same displays the value: No <input class="full-width has-padding" name="auth" type="submit" value="Create account"> And if I create it via <button name="auth">Submit<button> then the POST request is being processed - Vasily Gilbert