Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are using strange variables <code>POST_['first_name']</code>.</p> <p>Try this query: </p> <p>(<strong>Note:</strong> you have to use the quotes (<code>'</code> <code>'</code>) for the fields because you have a space in field names or use PDO to prepare and execute query.)</p> <pre><code>$sql="INSERT INTO $tbl_name (First Name, Last Name, Email, Address, Job) VALUES('$fname', '$lname', '$address', '$email')"; </code></pre> <p>Other issue is the <code>POST</code> array, you send <code>first_name</code> instead of <code>fname</code> and <code>last_name</code> instead of <code>lname</code>:</p> <pre><code>&lt;tr&gt; &lt;td&gt;&lt;input type="text" name="first_name" placeholder="Johnny"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="last_name" placeholder="Appleseed"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="email" placeholder="johnny@email.com"&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>This will return:</p> <pre><code>$_POST = array( "first_name" =&gt; "Johnny", "last_name" =&gt; "Appleseed", "email" =&gt; "johnny@email.com" ); </code></pre> <p>As you see you don't have <code>$_POST['fname']</code> and <code>$_POST['lname']</code> so you have to change: </p> <pre><code>$fname = $_POST['first_name']; $lname = $_POST['last_name']; </code></pre> <p>About <em>job</em>, you just didn't add it in <code>INSERT</code> statement: </p> <pre><code>$sql="INSERT INTO $tbl_name (First Name, Last Name, Email, Address, Job) VALUES('$fname', '$lname', '$address', '$email', '$job')"; </code></pre>
 

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