Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing form submission to update table records in php
    primarykey
    data
    text
    <p>I have created a support form for some clients, they submit information to it and I see it in a panel I have created. In this panel I want to have the ability to check a box next to a record and hit an update button and it will update that record with a time stamp showing I have completed the work and what time. Here is the sample code </p> <pre><code> echo "&lt;table border='1'&gt; &lt;tr&gt; &lt;th&gt;ICL&lt;/th&gt; &lt;th&gt;PAGE ID&lt;/th&gt; &lt;th&gt;SUBMISSION NAME&lt;/th&gt; &lt;th&gt;UPTDATES/BUGS&lt;/th&gt; &lt;th&gt;MISSING INFO&lt;/th&gt; &lt;th&gt;TIME OF SUBMISSION&lt;/th&gt; &lt;th&gt;COMPLETED&lt;/th&gt; &lt;th&gt;TIME COMPLETED&lt;/th&gt; &lt;/tr&gt;"; echo "&lt;form name='completed' action='insert4panel.php' method='post'&gt;"; while($row = mysql_fetch_array($results)) { echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['ICL'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['officename'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['submitname'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['feedback'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['missinginfo'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['TimeStamp'] . "&lt;/td&gt;"; echo "&lt;td&gt;&lt;input type='checkbox' name='complete'&gt;&lt;/td&gt;"; echo "&lt;td&gt;" . $row['completionstamp'] . "&lt;/td&gt;"; echo "&lt;/tr&gt;"; } echo "&lt;input type='submit' value='Update'&gt;"; echo "&lt;/form&gt;"; echo "&lt;/table&gt;"; </code></pre> <p>What happens when I hit submit I send it to this code </p> <pre><code>$timeissued=$_POST["complete"]; $date = date("m-d-y H:i:s"); mysql_query("INSERT INTO SITES (completed, completetime ) VALUES ('$timeissued' ,'$date')"); </code></pre> <p>I know that I'm not telling it which record I want to add the timestamp or the check box to, so it isn't going to do it, however it creates a new record with a timestamp doesn't save the check box and leaves the rest of the fields blank. I'm sure the answer is simple</p>
    singulars
    1. This table or related slice is empty.
    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