jeudi 29 janvier 2015

How to insert value of the checkbox array into the database while the cheekboxs value also have been retrieved from the database?

I am retrieving the result of the query from the database. in which i have stored id of the record into the checkbox.


connect_errno){ die('coudn\'t connect to the database' . mysqli_connect_error()); } else{ $query = "select * from simple"; $result = $conn -> query($query); echo 'SelectIDNameSurname'; while ($row = $result->fetch_array(MYSQLI_ASSOC)) { echo ''; echo ""; echo "{$row['id']} "."{$row['Name']}"."{$row['Surname']}"; echo ''; } echo ''; echo "Fetched data successfully\n"; $limit = count('$checkbox'); echo $limit; for($i=0;!$limit > 0;$i++,$limit--){ $res = implode(",", '$checkbox'); $q1 = 'insert into joint_data values("'.$i.'","'.$res.'")'; if($conn -> query($query) == TRUE){ echo "Data Entered successfully\n"; } echo $i,$res; } } $result->free(); mysqli_close($conn); ?>

I was able to retrieve the data and store into the checkbox array successfully. now i want to insert the value of the checkbox into different table.How can i do that?





Aucun commentaire:

Enregistrer un commentaire