Need help with checked checkboxes and mysql

I am trying to have an RSVP form on my wedding site but I am encountering a problem.

In the form, I want to ask my friends to choose which part of the day they will join, such as morning church ceremony, afternoon cocktail and/or dinner banquet. The website can be found here:

My mysql database can receive all data, including the name and comments from my friends but I have no luck in receiving which boxes are checked.

I have the fields “church”, “cocktail” and “dinner” in my DB. I have been googling for a few days and nights now and the only codes that are not generating any errors should run to check whether the boxes are checked. There are no errors displaying but I am not receiving any data in the db fields concerned.

Then I tried to test the fields with just textboxes instead of checkboxes and, in this case, the fields get the data.

I am in deep frustration to trying to make it work but with no luck. if anyone can enlighten me on what is wrong with my codes I would greatly appreciate. Here are the codes:

// Form for submitting new entries
$output .= ’
<form id=“new_entry” style=“text-align:left;” action=“‘.$gb_links[‘write’].’” accept-charset=“UTF-8” method=“POST”>
<input type=“hidden” name=“gb_link” id=“gb_link” value=“‘.$gb_links[‘plain’].’”>
<input type=“hidden” name=“gwolle_gb_function” value=“add_entry” />
<div class=“label”>‘.__(‘Name’,$textdomain).’:</div>
<div class=“input”><input class=“‘; if (in_array(‘name’, $error_fields)) { $output .= ’ error’; } $output .= '” value=“‘.$name.’” type=“text” name=“entry_author_name” /></div>
<div class=“clearBoth”> </div>

	&lt;div class="label"&gt;'.__('You&#146;re interested in joining our',$textdomain).':&lt;/div&gt;

	&lt;div&gt;Noon Church Ceremony &lt;input type="checkbox" name="chuch" value="church" /&gt;
	Afternoon Cocktail &lt;input type="checkbox" name="cocktail" value="cocktail" /&gt;

	Dinner Party &lt;input type="checkbox" name="dinner" value="dinner" /&gt;&lt;/div&gt;

if (church != NULL) {
church = 1;
else {
church = 0;
if (cocktail != NULL) {
cocktail = 1;
else {
cocktail = 0;
if (dinner != NULL) {
dinner = 1;
else {
dinner = 0;



at the top of your form handler to see the exact values being passed.

You probably want to do something more akin to:

echo 'Dinner was chosen';


… in order to surmise if dinner was checked.

The var_dump() call should help you understand what is going on.

Thanx for your quick reply. Please excuse my next dumb question: where should I put the PHP code that you have supplied?

<input type="checkbox" value="1" name="church" />

echo $_POST['church']; 


If church is checked, it will echo 1, if not, it will echo 0/null.

Thanx both of your replies. I may be so dumb that I have tried placing the PHP codes you suggested but ending up with an invalid T-string error. Where should I really place the PHP that you have provided?

exact error is Parse error: syntax error, unexpected T_STRING.

I have tried putting right after each checkbox or right before or right after the submit button. None of these works that it only brings about the same syntax error but on different lines. Where should I put it?

Post the error.
And post the code (all of it, do eliminate db passwords and the like) using the appropriate code tags:


 ... your code goes here ...