Adding a form array to MySQL using PHP -


i cannot array put mysql database in format 'arrayitem1,arrayitem2,etc...'

here's forms are:

<form action="http://www.nccskills.co.uk/bookings/process.php" method="post" name="bookingform">   <div id="row12">     <div class="col1">       <input type="checkbox" name="voccheck[]" value="hasa">       &nbsp;&nbsp;health , safety awareness     </div>     <div class="col2">       <input type="checkbox" name="voccheck[]" value="ead">       &nbsp;&nbsp;equality , diversity     </div>   </div>   <div id="row13">     <div class="col1">       <input type="checkbox" name="voccheck[]" value="ecc">       &nbsp;&nbsp;effective customer care     </div>     <div class="col2">       <input type="checkbox" name="voccheck[]" value="cc">       &nbsp;&nbsp;care certificate</div>     </div> 

what php use achieve this?

thanks in advance.

in process.php file want have code looks this:

//create connection using mysqli $conn = new mysqli($servername, $username, $password, $dbname);  //prepare statement. $conn->prepare('insert tablename(fieldname) values(?)');  //put checkboxes together, if selected. $checked = ''; if(is_array($_post['voccheck'])) {     $checked = implode(',', $_post['voccheck']); }  //bind value. $conn->bind_param('s', $checked);  //execute question. $conn->execute(); 

not 100% sure need check if $_post['voccheck'] array , cant try right included on safe side. might want throw error handling in case connection doesn't work etc. useful links you:


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -