Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy won't this form process?
    primarykey
    data
    text
    <p>I am switching to PDO, already had success with dozens of pages for this development site, and this one was supposed to be a "quickie" form -- should have only taken about ten minutes. But I'm commencing my second weekend trying to figure out why it won't work. I know the the following is insecure -- I've stripped it to bare bones to try to figure out why it won't process. The following does nothing more than reload the form page with fields blank. I'm not getting any errors, error logs don't show anything, and it never gets to the point of processing the form -- for instance, entering two different passwords isn't shown as an error, echoing variables isn't showing. It seems it's not even getting to the "if(isset" point -- and I can't figure out why. </p> <pre><code>&lt;?php try { $con = new PDO('mysql:host=localhost;dbname=database', $user, $pass); } catch (PDOException $e) { echo "Connection failed: " . $e -&gt; getMessage(); } if (isset($_POST['submit'])) { $email = $_POST['email']; $username = $_POST['username']; $pass1 = $_POST['pass1']; $pass2 = $_POST['pass2']; if ($pass1 != $pass2) { die ("ERROR: Hey! The passwords don't match!"); } $stmt = $con -&gt; prepare (" INSERT INTO proj_users (email, username, password) VALUES (?, ?, ?) "); $stmt -&gt; bindParam(1,$email); $stmt -&gt; bindParam(2,$username); $stmt -&gt; bindParam(3,$pass1); $stmt -&gt; execute(); header('Location: /index.php'); } else { ?&gt; &lt;form action='&lt;?php echo $_SERVER['SCRIPT_NAME']; ?&gt;' method='post'&gt; &lt;table&gt; &lt;tr&gt; &lt;td class='label'&gt;Email: &lt;/td&gt; &lt;td&gt;&lt;input type='text' name='email' /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class='label'&gt;Username: &lt;/td&gt; &lt;td&gt;&lt;input type='text' name='username' maxlength='30' /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class='label'&gt;Password: &lt;/td&gt; &lt;td&gt;&lt;input type='password' name='pass1' /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class='label'&gt;Password Again: &lt;/td&gt; &lt;td&gt;&lt;input type='password' name='pass2' /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class='label alignright' colspan='2'&gt;&lt;input type='submit' value='Register' /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;?php } ?&gt; </code></pre> <p><strong>UPDATE:</strong> As I go through and update more of my forms, I run into the same problem -- no "name" attribute, and yet they had been working before I started messing with them. Didn't take me long to figure out it was because I was re-writing the forms and in the process changing them from "!isset" to "isset" -- so, of course, with no "name," they never were. </p>
    singulars
    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.
    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