Note that there are some explanatory texts on larger screens.

plurals
  1. POUPDATE Syntax for use with HTML form and php
    text
    copied!<p>I have a form created in HTML. From time to time, our reps need to come back and edit data that they had entered into the form previously. I have it set up where they can enter the OrderForm ID (ex. 1234) and it will populate the fields accordingly. I would like them to be able then to update or make changes to the fields and then when they hit submit, it would create a new number with a .1 attached (1234.1), and update the MySQL database. </p> <p>I have been able to create the form, populate the search fields, but can't figure out how to update and assign a ".1" to the form ID.</p> <p>Here is my code:</p> <pre><code>&lt;?php $connection = mysql_connect('localhost','username','*******') or die ("Couldn't connect to server."); $db = mysql_select_db('DBName', $connection) or die ("Couldn't select database."); // ------------------------------------------------------------------- // Field Names // ------------------------------------------------------------------- $drepid=mysql_real_escape_string($_POST['drepid']); $datepicker=mysql_real_escape_string($_POST['datepicker']); $repemail=mysql_real_escape_string($_POST['repemail']); $dateneeded=mysql_real_escape_string($_POST['dateneeded']); $description=mysql_real_escape_string($_POST['description']); $qty=mysql_real_escape_string($_POST['qty']); $pgsizeh=mysql_real_escape_string($_POST['pgsizeh']); $pgsizew=mysql_real_escape_string($_POST['pgsizew']); $pageno=mysql_real_escape_string($_POST['pageno']); $stock=mysql_real_escape_string($_POST['stock']); $ink=mysql_real_escape_string($_POST['ink']); $inknote=mysql_real_escape_string($_POST['inknote']); $rfq=mysql_real_escape_string($_POST['rfq']); $finishing=mysql_real_escape_string($_POST['finishing']); $dfirstname=mysql_real_escape_string($_POST['dfirstname']); $dlastname=mysql_real_escape_string($_POST['dlastname']); $dorganization=mysql_real_escape_string($_POST['dorganization']); $email=mysql_real_escape_string($_POST['email']); $daddress1=mysql_real_escape_string($_POST['daddress1']); $daddress2=mysql_real_escape_string($_POST['daddress2']); $dcity=mysql_real_escape_string($_POST['dcity']); $dstate=mysql_real_escape_string($_POST['dstate']); $dzip=mysql_real_escape_string($_POST['dzip']); $phone=mysql_real_escape_string($_POST['phone']); $fax=mysql_real_escape_string($_POST['fax']); $proof=mysql_real_escape_string($_POST['proof']); $whoproof=mysql_real_escape_string($_POST['whoproof']); $quote=mysql_real_escape_string($_POST['quote']); $amount=mysql_real_escape_string($_POST['amount']); $delivery=mysql_real_escape_string($_POST['delivery']); $notes=mysql_real_escape_string($_POST['notes']); $data = "UPDATE DB_Table SET drepid='$drepid', datepicker='$datepicker', repemail='$repemail', dateneeded='$dateneeded', description='$description', qty='$qty', pgsizeh='$pgsizeh', pgsizew='$pgsizew', pageno='$pageno', stock='$stock', ink='$ink', inknote='$inknote', rfq='$rfq', finishing='$finishing', dfirstname='$dfirstname', dlastname='$dlastname', dorganization='$dorganization', email='$email', daddress1='$daddress1', daddress2='$daddress2', dcity='$dcity', dstate='$dstate', dzip='$dzip', phone='$phone', fax='$fax', proof='$proof', whoproof='$whoproof', quote='$quote', amount='$amount', delivery='$delivery', notes='$notes' WHERE drfq=.$drfq"; $query = mysql_query($data) or die("Couldn't execute query\"$data\" Error:" . mysql_error()); ?&gt; </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