Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I insert an HTML form into a MySQL Database?
    text
    copied!<p>I am working on a billing system,, It's very basic right now but I was wondering if you could help me with my code. How do I insert the data from the HTML form into a MySQL database? My code:</p> <pre><code>&lt;?php if (isset($_POST['submitted'])) { include('connect-mysql.php'); $date = $_POST['date']; $charge = $_POST['charge']; $payment = $_POST['payment']; $client_no = $_POST['client_no']; $client_name = $_POST['client_name']; $check_no = $_POST['check_no']; $check = $_POST['check']; $cash = $_POST['cash']; $notes = $_POST['notes']; $staff_initials = $_POST['staff_initials']; $sqlinsert = "INSERT INTO payments (date, charge, payment, client_no, client_name, check_no, check, cash, notes, staff_initials) VALUES ('$date', '$charge', 'payment', '$client_no', '$client_name', '$check_no', '$check', '$cash', '$notes', '$staff_initials')"; if (!mysqli_query($dbcon, $sqlinsert)) { die('There was an error when trying to process your payment. Please contact technical support.'); } //end of nested if statement } // end of the main if statement ?&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;New Payment&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Please Input Payment Details&lt;/h1&gt; &lt;form action="new_payment.php" method="POST"&gt; &lt;input type="hidden" name="submitted" value="true" /&gt; &lt;fieldset&gt; &lt;legend&gt;New Payment&lt;/legend&gt; &lt;label&gt;Date:&lt;input type="text" name="date" /&gt;&lt;/label&gt;&lt;br&gt; &lt;label&gt;Today's Charge: &lt;input type="text" name="charge" /&gt;&lt;/label&gt;&lt;br&gt; &lt;label&gt;Today's Payment: &lt;input type="text" name="payment" /&gt;&lt;/label&gt;&lt;br&gt; &lt;label&gt;Client Number: &lt;input type="text" name="client_no" /&gt;&lt;/label&gt;&lt;br&gt; &lt;label&gt;Client Name: &lt;input type="text" name="client_name" /&gt;&lt;/label&gt;&lt;br&gt; &lt;label&gt;Check Number: &lt;input type="text" name="check_no" /&gt;&lt;/label&gt;&lt;br&gt; &lt;label&gt;Check: &lt;input type="text" name="check" /&gt;&lt;/label&gt;&lt;br&gt; &lt;label&gt;Cash: &lt;input type="text" name="cash" /&gt;&lt;/label&gt;&lt;br&gt; &lt;label&gt;Notes: &lt;input type="text" name="notes" /&gt;&lt;/label&gt;&lt;br&gt; &lt;label&gt;Staff Initials: &lt;input type="text" name="staff_initials" /&gt;&lt;/label&gt;&lt;br&gt; &lt;/fieldset&gt; &lt;br /&gt; &lt;input type="submit" value="Process Payment"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Please help me, this is very important that I finish this in a timely manner...</p>
 

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