Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding one php button per line in a table
    primarykey
    data
    text
    <p>I'm trying to build a very basic table to display the results of a query and allow posting the ID from one row (selected with a button on that row) to another php form for further editing the entry. A pretty basic todo list.</p> <p>I've been able to make a nice looking table but am a bit stumped about how to get the TaskID value from the array into the value of the form. </p> <p>Immediately above and below the form is ?> and <p>Can someone point out the flaw in my logic? I've tried using an intermediate variable $tmp but this did nothing. I've googled and searched but am not sure how to implement this. I'm not great a java and ajax so many of the other solutions I've spotted on the web haven't panned out.</p> <pre><code>$result = mysql_query("SELECT * FROM Tasks WHERE ISNULL(AssignedTo)") or die(mysql_error()); echo "&lt;table border='1'&gt;"; echo "&lt;tr&gt; &lt;th&gt;ID&lt;/th&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Priority&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt; &lt;th&gt;Location&lt;/th&gt; &lt;th&gt;Location2&lt;/th&gt; &lt;th&gt;Update this Entry&lt;/th&gt;&lt;/tr&gt;"; while($row = mysql_fetch_array( $result )) { $tmp=$row['TaskID']; echo "&lt;tr&gt;&lt;td&gt;"; echo $row['TaskID']; echo "&lt;td&gt;"; echo $row['TaskName']; echo "&lt;td&gt;"; echo $row['TaskPriority']; echo "&lt;td&gt;"; echo $row['TaskDesc']; echo "&lt;td&gt;"; echo $row['TaskContainer']; echo "&lt;td&gt;"; echo $row['TaskContainerIdentifier']; echo "&lt;td&gt;"; ?&gt; &lt;form name="form" method="POST" action="form_updatetask.php"&gt; &lt;input value=$tmp type="hidden" name="search"&gt; &lt;input type="submit" value="Update"&gt; &lt;/form&gt; &lt;?php } echo "&lt;/td&gt;&lt;/tr&gt;"; echo "&lt;/table&gt;"; ?&gt; </code></pre>
    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