I have a survey questionnaire, one section has checkbox which are suppose to be submitted into my database if checked individually but Im having trouble writing a query, at the moment it submitting everything but I want it to submit what is checked
here is my code
html
Code: Select all
<table width="" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Don’t want to download any software on my PC</td>
<td><input type="checkbox" name="Question1a[]" value="Dont want"> </td>
</tr>
<tr>
<td>I couldn’t download because my computer is slow </td>
<td><input type="checkbox" name="Question1a[]" value="I couldnt"> </td>
</tr>
<tr>
<td>I don’t have enough memory on my PC </td>
<td><input type="checkbox" name="Question1a[]" value="I dont have"> </td>
</tr>
<tr>
<td>I’m satisfied with range of games available on Instant Play Casino </td>
<td><input type="checkbox" name="Question1a[]" value="Im satsfied"> </td>
</tr>
<tr>
<td>I would like to have reassurance your software is safe</td>
<td><input type="checkbox" name="Question1a[]" value="I would like"> </td>
</tr>
</table>Code: Select all
$username = $_POST['username'];
$question1 = $_POST['Question1'];
$question1a = $_POST['Question1a'];
$question2 = $_POST['Question2'];
$question3 = $_POST['Question3'];
$question4 = $_POST['Question4'];
$question5 = $_POST['Question5'];
$question6 = $_POST['Question6'];
$question6a = $_POST['Question6a'];
$question6b = $_POST['Question6b'];
$question6c = $_POST['Question6c'];
$question7 = $_POST['Question7'];
$question8 = $_POST['Question8'];
$submit_date = date("F j, Y, g:i a");
/******* Question1a variables **********/
$question1a = $_POST['Dont want'];
$question1a = $_POST['I couldnt'];
$question1a = $_POST['I dont have'];
$question1a = $_POST[' Im satsfied'];
$question1a = $_POST['I would like'];
/****************************************/
Dont want,I couldnt,I dont have,Im satsfied,I woul...
$insquery = "INSERT INTO survey (username,Question1,Question2, Question3, Question4, Question5, Question6, Question6a, Question6b, Question6c, Question7, Question8, submit_date) VALUES ('$username','$question1','$question2','$question3','$question4', '$question5', '$question6', '$question6a','$question6b','$question6c','$question7','$question8','$submit_date')";
// $insquery = "INSERT INTO survey SET Question1a = '1,2,3,4,5'";
$insquery = "INSERT INTO survey(Question1a) VALUES('Dont want,I couldnt,I dont have,Im satsfied,I would like')";
$result = mysql_query($insquery) or die ("Invalid Insert Query");