php - inserting checkbox values to database -
i have php form textbox , checkboxes connected database want enter details database form.all textbox values getting entered except checkbox values.i have single column in table entering checkbox values , column name urlid.i want enter selected checkbox(urlid)values single column ,separated commas.i have attached codings used.can find error , correct me? note: (the urlid values in form brought previous php page.those codings included.need not care it)
urlid[]: <br><?php $query = "select urlid webmeasurements"; $result = mysql_query($query); while($row = mysql_fetch_row($result)) { $urlid = $row[0]; echo "<input type=\"checkbox\" name=\"checkbox_urlid[]\" value=\"$row[0]\" />$row[0]<br />"; $checkbox_values = implode(',', $_post['checkbox_urlid[]']); } ?>
$urlid=''; if(isset($_post['urlid'])) { foreach ($_post['urlid'] $statename) { $urlid=implode(',',$statename) } } $q="insert table (urlid) values ($urlid)";
Comments
Post a Comment