Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm a little confused by your question, so you want 1 page that allows the user to fill in a blank form, see a filled out form and update a form?</p> <p>You can do the blank form or filled form by checking if an id exist, like this:</p> <pre><code>&lt;? if (isset(id)) // Here you can check if the id exists, which means you will be doing an update to the sql echo' &lt;form method="post" action="pv.php?id=' . $row['ID'] . '&amp;action=' . $form_action . '"&gt; &lt;!-- Your form here with values --&gt; e.g. &lt;label for="cemail"&gt;Last Name&lt;/label&gt; * &lt;input id="cemail" type="text" name="lastname" value="' . $row['Last_Name'] . '" maxlength="75" /&gt; &lt;/form&gt;'; // Put your sql update here to take the values from the above form } elseif (!isset(id)) // Here there is no id so you will want to insert { echo' &lt;form method="post" action="pv.php?id=' . $row['ID'] . '&amp;action=' . $form_action . '"&gt; &lt;!-- Your form here with values --&gt; e.g. &lt;label for="cemail"&gt;Last Name&lt;/label&gt; * &lt;input id="cemail" type="text" name="lastname" maxlength="75" /&gt; // No value here because will insert new record &lt;/form&gt;'; // Put your sql insert here to create a new record } ?&gt; </code></pre> <p>Do you also want the user to be able to add a new comment entirely rather than editing the one already associated with their id? I think you would have to do this by giving them the option to add another comment, to do this I would create a new table and then insert the comments into that, so you have one table with the user information, then another table with the user comments, for example:</p> <pre><code>example_users: id = 1 fname=Joe lname=Bloggs email=jbloggs@example.com user_comments id=1 user_id=1 comment = Comment will be saved here </code></pre> <p>This way any user can have any number of comments, you could render this on the page by using a foreach statement to render a text box with all their existing comments and then have a blank one at the end for any new ones, then they can edit any comment and add a new comment. </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.
 

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