Note that there are some explanatory texts on larger screens.

plurals
  1. POfill textbox with mysql data
    text
    copied!<p>How do I fill an inputbox with mysql data. So that I can update the database? I have this code that will show the table corresponding to the users request. But I don't know the syntax on how I can fill an inputbox with mysql data.</p> <pre><code> $result = mysql_query("SELECT * FROM t2 WHERE STAT='{$_POST["stat1"]}'"); echo "&lt;table border='1'&gt; &lt;tr&gt; &lt;th&gt;HospNum&lt;/th&gt; &lt;th&gt;RoomNum&lt;/th&gt; &lt;th&gt;LastName&lt;/th&gt; &lt;th&gt;FirstName&lt;/th&gt; &lt;th&gt;MidName&lt;/th&gt; &lt;th&gt;Address&lt;/th&gt; &lt;th&gt;TelNum&lt;/th&gt; &lt;th&gt;Status&lt;/th&gt; &lt;th&gt;Nurse&lt;/th&gt; &lt;/tr&gt;"; while($row = mysql_fetch_array($result)) { echo "&lt;tr&gt;"; echo "&lt;td&gt;" . $row['HOSPNUM'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['ROOMNUM'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['LASTNAME'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['FIRSTNAME'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['MIDNAME'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['ADDRESS'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['TELNUM'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['STAT'] . "&lt;/td&gt;"; echo "&lt;td&gt;" . $row['NURSE'] . "&lt;/td&gt;"; </code></pre> <p>echo ""; } echo "";</p> <p>And I want to display the corresponding records with this html form, by inputting a primary key. And clicking the search button, the record will appear on each box. Just like when you update mysql database through phpmyadmin. But this time using a custom html form.</p> <pre><code>&lt;td width="168"&gt;&lt;input name="hnum" type="text" id="hospnum"&gt;&lt;/td&gt; &lt;td width="41"&gt;&lt;font size="3"&gt;Room #&lt;/td&gt; &lt;td width="3"&gt;:&lt;/td&gt; &lt;td width="168"&gt;&lt;input name="rnum" type="text" id="rnum"&gt;&lt;/td&gt; </code></pre> <p>how can I do that?</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