How do I insert multiple checkbox data into MySQL, I tried to put it in the database but it says array or it will only store on piece of data instead of multiple data
Heres my code:
html:
<input type="checkbox" name="tran[]" value="Mon">
Monday
<input type="checkbox"name="tran[]" value="Tue">
Tuesday
<input type="checkbox" name="tran[]" value="Wed">
Wednesday
<input type="checkbox" name="tran[]" value="Thur">
Thursday
<input type="checkbox"name="tran[]" value="Fri">
Friday
php:
$tran = $_POST[tran];
if($_POST['Submit'] == 'Submit')
{
mysql_query("INSERT INTO $usertable(`days`,`time`,`trans`,`subject`,`grade`,`skill`,`oskill`,`status`) VALUES ('$day','$time','$tran','$subj', '$grade', '$skills','$oskill','1')")or die(mysql_error());
}
HElP insert multiple checkbox data into MySQL
Moderator: General Moderators
Re: HElP insert multiple checkbox data into MySQL
Probably because $_POST["tran"] is an array.dynastym3 wrote:I tried to put it in the database but it says array
So fix your code. I don't know what you're trying to do with it so I can't offer much more help.dynastym3 wrote:or it will only store on piece of data instead of multiple data
Re: HElP insert multiple checkbox data into MySQL
basically if I click on Mon & Tues I want it to show Mon Tues in the data base in. But it will only show one of days that I click on in the database.
Re: HElP insert multiple checkbox data into MySQL
any sugestions??? HELP!!!