Deanznet Posted November 27, 2007 Share Posted November 27, 2007 How would one go about submitting check box data to mysql database. // Retrieve all the data from the table $result = mysql_query("SELECT * FROM phpbb_adr_shops_items WHERE item_owner_id = '1' ") or die(mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print "<table width=200 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"; That gets all the stuff in that table.. I want to know how to get check box their and have a drop list box i guess with Different options Ex. Buy or Sell I would have to use a loop for this because i have more than 1 item in the table and i prob will always add more. Will it have to have the item id from the mysql table.. because i have a table that has the item id in it also. Quote Link to comment Share on other sites More sharing options...
Daukan Posted November 27, 2007 Share Posted November 27, 2007 This might work. I change fetch row to fetch assoc so you can use the col name to call it. You shouldn't need the foreach loop <?php // Retrieve all the data from the table $result = mysql_query("SELECT * FROM phpbb_adr_shops_items WHERE item_owner_id = '1' ") or die(mysql_error()); $num_rows = mysql_num_rows($result); print "There are $num_rows records.<P>"; print '<form action="" method="post"><table width=200 border=1>'."\n"; while ($get_info = mysql_fetch_assoc($result)){ print "<tr>\n"; print "\t<td><font face=arial size=1/>"; print '<input type="chechbox" name"somename" />'.$get_info['col_name1'].'</font></td>\n'; print '<input type="chechbox" name"somename" />'.$get_info['col_name2'].'</font></td>\n'; print '<input type="chechbox" name"somename" />'.$get_info['col_name3'].'</font></td>\n'; print "</tr>\n"; } print "</table></form>\n"; ?> Quote Link to comment Share on other sites More sharing options...
Deanznet Posted November 27, 2007 Author Share Posted November 27, 2007 That was weird it should a whole bunch of blank text box with nothing in it Lol I need to to also display the items in the table.. Each item has a description and a price so it look like this X- represents check box X item name Item Description Price Picture X item name Item Description Price Picture X item name Item Description Price Picture list box submit Also im not sure how to do this 100% but when i hit submit im going to have it post to a file and depending on what was selected. lets say buy was selected it will change subtract the price from their cash and than also update the owner name and the change item in show from 1 to 0. because each item has fields in the database such as Item id, item owner, Item price, Item Desc Item in Shop etc.. So if you know how to do this if you can explain Quote Link to comment Share on other sites More sharing options...
Deanznet Posted November 27, 2007 Author Share Posted November 27, 2007 Anyone? ??? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.