Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, don't use <code>font</code> tags...<a href="http://www.w3.org/TR/html4/present/graphics.html#h-15.2" rel="nofollow">ever</a></p> <p>Secondly, because of this line:</p> <pre><code>if (isset($_POST['dothis'])) { </code></pre> <p>It looks like your HTML and PHP are combined into one script? In which case, you'll need to change the action on the form to something like this:</p> <pre><code>&lt;form method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" &gt; </code></pre> <p>Plus, you can kill a bad connection in one line:</p> <pre><code>$con = mysql_connect("localhost","root","password") or die("I died, sorry." . mysql_error() ); </code></pre> <p>Check your posts with <code>isset()</code> and then assign values to variables.</p> <pre><code>var $company; if(isset($_POST['Company']) { $company = $_POST['Company']; } else { $company = null; } //so on and so forth for the other fields </code></pre> <p>Or use <a href="http://davidwalsh.name/php-shorthand-if-else-ternary-operators" rel="nofollow">ternary operators</a></p> <p>Also, using the original <code>mysql</code> PHP API is usually a bad choice. It's even mentioned in the <a href="http://www.php.net/manual/en/function.mysql-connect.php" rel="nofollow">PHP manual for the API</a></p> <p>Always better to go with <code>mysqli</code> or <code>PDO</code> so let's convert that:</p> <pre><code>//your connection $conn = mysqli_connect("localhost","username","password","averyit_net"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $sql = "INSERT INTO cust_profile (Customer_Name, Customer_Type, Contract_Hours) VALUES ($company,$custType,$contractHours)"; // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // Assuming you set these $stmt = mysqli_prepare($conn, $sql); $stmt-&gt;execute(); $stmt-&gt;close(); </code></pre> <p>Someone tell me if this is wrong, so I can correct it. I haven't used <code>mysqli</code> in a while.</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.
    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