0

I was following a guide on creating a secure log in with PHP, it was relatively easy to understand since I am very new to the language. When I finished I tried to check it out on my MAMP server, and none of the form for the register page shows up. What could be causing this?

tutorial I used here: http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL

The Code in Question: (HTML / PHP)

 <form action="<?php echo esc_url($_SERVER['PHP_SELF']); ?>" 
                method="post" 
                name="registration_form">
            Username: <input type='text' 
                name='username' 
                id='username' /><br>
            Email: <input type="text" name="email" id="email" /><br>
            Password: <input type="password"
                             name="password" 
                             id="password"/><br>
            Confirm password: <input type="password" 
                                     name="confirmpwd" 
                                     id="confirmpwd" /><br>
            <input type="button" 
                   value="Register" 
                   onclick="return regformhash(this.form,
                                   this.form.username,
                                   this.form.email,
                                   this.form.password,
                                   this.form.confirmpwd);" /> 
        </form>

I have tried using a different style of formatting, but I believe it's directly related to the echo esc_url in the form action, any ideas on fixing this?

My form does display with this syntax:

<form>
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit">
</form>
knocked loose
  • 3,142
  • 2
  • 25
  • 46
  • What do you mean, "none of the form for the register page shows up"? Do you mean you can't see any of the form elements? Have you viewed the source to see if the code is there? – John Conde Nov 19 '14 at 19:43
  • Yes, the inputs, form and register are not showing. It does not even appear in the source code, even though the file has them in there. – knocked loose Nov 19 '14 at 19:43
  • so what does the generated html look like? There's no way that your esc_url function could get rid of the `action=` attribute. – Marc B Nov 19 '14 at 19:45
  • Viewing in the source shows the full page with all the text, but ends with
    – knocked loose Nov 19 '14 at 19:46
  • Turn on error_reporting. You have aPHP error. – John Conde Nov 19 '14 at 19:52

1 Answers1

0

At first try clearing your cache in the browser , check if every file is correct in your MAMP.

 <form action="" method="post" >

replace:
   <input type="button" 
               value="Register" 
               onclick="return regformhash(this.form,
                               this.form.username,
                               this.form.email,
                               this.form.password,
                               this.form.confirmpwd);" /> 

to:

 <input type="submit" value="register"name="register">
PHP:
if(isset($_POST['register']))
 {
   //whatever you want your form to do
 }
  • It is not a cacheing error, as I can add html anywhere and it will display, I am currently enabling error reporting to see if that says anything – knocked loose Nov 19 '14 at 19:57