The html checkbox before query, I chose option 1 and option 4
the data where the values should be stored, but it stores into option 1 and option 2 columns instead while it should store it inside both 'opt1' and 'opt4'
PHP
if( isset( $_POST['picked'] ) )
{
$keepdata = array();
$keepdata = $_POST['pick'];
$sqlinsert = "INSERT INTO traincheckbox VALUES ( null, '$keepdata[0]', '$keepdata[1]', '$keepdata[2]', '$keepdata[3]', '$keepdata[4]' )";
mysqli_query( $sqlnrg, $sqlinsert );
header( "Location: pick.php" );
}
HTML
<html>
<form method="post">
<input type="checkbox" name="pick[]" value="PAID"><label>Activity 1</label></input>
<input type="checkbox" name="pick[]" value="PAID"><label>Activity 2</label></input>
<input type="checkbox" name="pick[]" value="PAID"><label>Activity 3</label></input>
<input type="checkbox" name="pick[]" value="PAID"><label>Activity 4</label></input>
<input type="checkbox" name="pick[]" value="PAID"><label>Activity 5</label></input>
<button type="submit" name="picked">Pick activities</button>
</form>
</html>