Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Insert Multidimensional Array into mysql
    primarykey
    data
    text
    <p>i try to store the booking booths into database based on user selection, there are 10 check boxes for each booths and user can choose which day they want to reserve booths. For each check box has it own field in database, if user choose booth A01, D1 and D2, when he press reserve button, it will insert value into D1 and D2. But I dont know how to get the checked checkbox value to store in database</p> <p>my booth interface <a href="http://i.imgur.com/umYcI.gif" rel="nofollow">http://i.imgur.com/umYcI.gif</a></p> <p>my table structure <a href="http://i.imgur.com/vKh6R.gif" rel="nofollow">http://i.imgur.com/vKh6R.gif</a></p> <p>My coding</p> <pre><code>&lt;?php session_start(); if ( !isset($_SESSION['AUTHORIZED_USERNAME']) || empty($_SESSION['AUTHORIZED_USERNAME']) ) { header("location:index.php"); }else{ $user=$_SESSION['AUTHORIZED_USERNAME']; } include('db.php'); if($_REQUEST){ $id = $_REQUEST['search_category_id']; $query2 = mysql_query("SELECT filenameBig, filename, url FROM eventinfo where eventID ='$id'"); $row = mysql_fetch_array($query2, MYSQL_ASSOC); if($id == -1) { echo "&lt;style type='text/css'&gt;#btn_submit{visibility:hidden}&lt;/style&gt;"; } else{ /*echo "&lt;a href='{$row['url']}'&gt;Click me!&lt;/a&gt;";*/ echo "&lt;p&gt;&lt;br&gt;&lt;img src='{$row['filename']}' alt='' /&gt;&lt;/p&gt;"; echo "&lt;p&gt;&lt;/p&gt;"; echo "&lt;p align='right'&gt;&lt;a href='$row[filenameBig]' target='_blank'&gt;Click to view large image&lt;/a&gt;&lt;/p&gt;"; echo "&lt;hr size='1'&gt;"; echo "&lt;div style='padding-left:4px;' align='left'&gt;&lt;strong&gt;Booths Listing&lt;/strong&gt;"; echo "&lt;p&gt;&lt;/p&gt;"; $query = "select boothAlias, totalDay from booths, eventinfo where booths.eventID=eventinfo.eventID &amp;&amp; booths.eventID = ".$id.""; $_SESSION['EVENT_ID']=$id; $result = mysql_query($query); $result2= mysql_query($query); echo "&lt;table border='0' style='width:400px;table-layout:fixed' &gt;"; $rows2 = mysql_fetch_array($result); $Day=$rows2['totalDay']; echo "&lt;table&gt;"; for ($day = 0; $day &lt;= $Day; ++$day) { if($day==0){ echo "&lt;th&gt;Booth&lt;/th&gt;"; }else{ echo "&lt;th&gt;D".$day."&lt;/th&gt;"; } } while($rows = mysql_fetch_array($result2)){ $boothAlias=$rows['boothAlias']; $totalDay=$rows['totalDay']; echo "&lt;tr&gt;&lt;td&gt;$boothAlias&lt;/td&gt;"; for ($day2 = 1; $day2 &lt;= $totalDay; ++$day2) { echo "&lt;td&gt;&lt;input name='day2[]' type='checkbox' value='$day2' /&gt;&lt;/td&gt;"; } echo "&lt;/tr&gt;"; } echo "&lt;/table&gt;"; } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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