how to save all dynamic checkboxes value in one table.(mysq)
Posted: Fri Apr 20, 2007 6:59 am
feyd | Please use
php code looks like :[/syntax]
and my html code looks like, where i am generating all questions :
but with this code i am getting "Array" as a value in database.
anyidea, where i am doing wrong !
thanks.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hi everyone,
i have no. of dynamic checboxes in my form.
now not able to figure out in this code that how can i save all checkbox values in one table.
[b]my DB table's format is :[/b]
[syntax="sql"]mas_id int(11) NOT NULL auto_increment,
name varchar(20) NOT NULL default '',
que_id text NOT NULL,Code: Select all
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$que_id = '';
foreach($_POST["que_id"] AS $key => $value){
$insertSQL = sprintf("INSERT INTO ts_masterset (que_id, name) VALUES (%s, %s)",
GetSQLValueString($_POST['que_id'], "text"),
GetSQLValueString($_POST['name'], "text"));}Code: Select all
<?php $questionsInclude = mysql_query("SELECT * FROM ts_questions WHERE setid='".$row_tsset['id']."'");
while($aquestionsInclude = mysql_fetch_array($questionsInclude)){
$qd = $aquestionsInclude['id'];
echo "<input name='que_id[]' type='checkbox' value='$qd'>";
echo $aquestionsInclude['question'];
echo "<br>"; }?>anyidea, where i am doing wrong !
thanks.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]