linuxfond |
05-06-2004 04:12 PM |
MySQL/PHP - checkboxes etc
Hello,
Sorry for not doing my homework. Naturally, I should figure this out myself, but at this moment I got no time for this, hence I ask for your, LQ experts', help.
Here is a simple code:
Code:
<?php
$db="bibliography";
$link = mysql_connect("localhost","root","");
if (! $link)
die("Couldn't connect to MySQL");
mysql_select_db($db , $link)
or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT * FROM periodicals" )
or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
print "There are $num_rows records.<P>";
print "<table width=70% border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
mysql_close($link);
?>
Obviously, it connects to the database "bibliography" and produces an HTML output with the contents of the table "periodicals". All this is perfect, but, not useful. I need the results to appear in a table containing a form, which will display a checkbox next to each raw so that I can check it and insert into the next page by hitting on Subimt button. I might need to check a few checkboxes in order to pick up more than one record. Tonight I spent well over four hours, and I am still not arriving at anything working. A little hint would get me started. Thank you.
|