Hi. I am new in using PHP and I am having a Parse Error: syntax error $end on the last number which is empty. Please, I need your help to help me find out where I did wrong or missing. I read all the posts here and did all possibility to correct but still giving me the problem. Maybe you can find it although I will keep trying. I will post the code twice as this is too long. Thanks.
<?php
function helper_checked($bool) {
return $bool ? 'checked="checked"' : '';
}
function helper_selected($bool) {
return $bool ? 'selected="selected"' : '';
}
function helper_disabled($bool) {
return $bool ? 'disabled="disabled"' : '';
}
function safeEcho($fld) {
echo htmlspecialchars($fld,ENT_QUOTES,'UTF-8');
}
function helper_error($fld) {
global $error;
if (!empty($error[$fld])) {
echo '<p class="error">'.$error[$fld]."</p>\n";
}
}
function highlight($fld) {
global $error;
return !empty($error[$fld]) ? 'error' : '';
}
include('templates/auw_test/forms/defaultregistration.php');
global $form, $error;
if (empty($form)) {
$form = $defaults;
}
?>
<?php if (!empty($error)) : ?>
<div class="error">
<?php if (!empty($error['transaction'])) : ?>
<h3><?php echo $error['transaction']; ?></h3>
<?php else : ?>
<h3>There are errors.</h3>
<p>We are unable to process your request due to the following errors on the form. Please correct them and resubmit the form.</p>
<ul>
<?php foreach ($error as $fld => $msg) : ?>
<li><a href="#<?php echo $fld; ?>"><?php safeEcho($msg); ?></a></li>
<?php endforeach; ?>
</ul>
<p>Click on a link to be taken to the field with the problem.</p>
<?php endif; ?>
</div>
<?php endif; ?>
<fieldset clas="formsection">
<h2>2009 Annual Recognition Luncheon - April 17, 2009</h2>
<p>Please note: You cannot register online without paying by credit card.</p>
<h3>Early Bird by March 25th</h3>
<fieldset id="Guest_number" class="checkbox <?php echo highlight('Guest_number'); ?>">
<legend>$50 per individual or $500 per table of ten if payment is received by March 25th</legend>
<?php foreach ($preset_amounts as $amount) :?>
<label><input name="Guest_number" class="checkbox" type="checkbox"
value="<?php echo $Guest_number; ?>" <?php echo helper_checked($form['Guest_number'] == $amount) ?>
onclick="$('Guest_number').disabled=true;" />
I wish to make reservations for
<select id="Guest_number2" name="Guest_number2">
<?php foreach ($number_select as $select => $prompt):?>
<option value ="<?php echo $select; ?>" <?php echo helper_selected($select == $form['Guest_number2']);?>>
<?php safeEcho($prompt);?>
</option>
<?php endforeach;?>
</select>
persons at $50 per person.<?php echo $select; ?></label><?php endforeach;?>
<?php helper_error('Guest_number2');?>
<br />
<?php foreach ($preset_numbers as $Guest_number2) : ?>
<label><input name="Guest_number2" class="checkbox" type="checkbox"
value="<?php echo $Guest_number2; ?>" <?php echo helper_checked($form['Guest_number2'] == $Guest_number2) ?>
onclick="$('Guest_number2').disabled=true;" />
I wish to make reservations for
<select id="Guest_number2" name="Guest_number2">
<?php foreach($number_select as $code =>$prompt) : ?>
<option value = "<?php echo $code; ?>" <?php echo helper_selected($code == $form['Guest_number']); ?>>
<?php safeEcho($prompt); ?>
</option>
<?php endforeach;?>
</select>
table(s) at $500 per table.<?php echo $code; ?></label><?php endforeach;?>
<?php helper_error('Guest_number');?><?php helper_error('Guest_number2');?>
</div>
</fieldset>
</fieldset>
<h3>After March 25th:</h3>
<fieldset id="Guest_number" class="checkbox <?php echo highlight('Guest_number'); ?>">
<legend>$55 per inidividual or $550 per table of ten if payment is received by March 25th.</legend>
<?php foreach ($preset_numbers as $Guest_number): ?>
<label><input name="Guest_number" class="checkbox" type="checkbox"
value="<?php echo $Guest_number; ?>" <?php echo helper_checked($form['Guest_number'] == $number) ?>
onclick="$('Guest_number').disabled=false;" />
I wish to make reservations for
<select id="Guest_number2" name="Guest_number2">
<?php foreach($number_select as $code => $prompt): ?>
<option value = "<?php echo $code;?>" <?php echo helper_selected($code == $form['Guest_number']);?>>
<?php safeEcho($prompt);?>
</option>
<?php endforeach;?>
</select>
persons at $55 per person.</label>
<?php helper_error('Guest_number');?>
<br />
<?php foreach ($person_numbers as $Guest_number) : ?>
<label><input name="Guest_number" class="checkbox" type="checkbox"
value="<?php echo $Guest_number; ?>" <?php echo helper_checked($form['Guest_number'] == $number) ?>
onclick="$('Guest_number').disabled=false;" />
I wish to make reservations for
<select id="Guest_number3" name="Guest_number3">
<?php foreach ($number_select as $code => $prompt) : ?>
<option value ="<?php echo $code; ?>" <?php echo helper_selected($code == $form['Guest_number3']);?>>
<?php safeEcho($prompt);?>
</option>
<?php endforeach; ?>
</select>
table(s) at $550 per table.</label>
<?php helper_error('Guest_number3');?>
</div>
</fieldset>
<fieldset id="fieldset-credit_card" class="formsection">
<legend class="hide">Credit Card Information</legend>
<h2>Please enter your credit card details.</h2>
<p>Online donations can only be accepted via credit or debit cards. Your details will be treated in
the strictest confidentiality.</p>
<fieldset id="registration_cc_type" class="radiogroup <?php echo highlight('registration_cc_type'); ?>">
<legend>Credit Card Type</legend>
<label><input name="registration_cc_type" class="radio" type="radio" value="visa" <?php echo helper_checked($form['registration_cc_type'] == 'visa') ?> /> Visa</label>
<label><input name="registration_cc_type" class="radio" type="radio" value="mastercard" <?php echo helper_checked($form['registration_cc_type'] == 'mastercard') ?> /> Master Card</label>
<label><input name="registration_cc_type" class="radio" type="radio" value="amex" <?php echo helper_checked($form['registration_cc_type'] == 'amex') ?> /> AMEX</label>
<?php helper_error('registration_cc_type'); ?>
</fieldset>
<div id="fld-registration_cc_number" class="formfield <?php echo highlight('registration_cc_number'); ?>">
<label for="registration_cc_number">Credit Card number:</label>
<input id="registration_cc_number" name="registration_cc_number" class="text" type="text" maxlength="19" value="<?php safeEcho($form['registration_cc_number'])?>" />
<?php helper_error('registration_cc_number'); ?>
</div>
<div id="fld-registration_cc_code" class="formfield <?php echo highlight('registration_cc_code'); ?>">
<label for="registration_cc_code">Credit card security code: <span class="explain">(<a href="#">what is this?</a>)</span></label>
<input id="registration_cc_code" name="registration_cc_code" class="text" type="text" maxlength="4" value="<?php safeEcho($form['registration_cc_code'])?>" />
<?php helper_error('registration_cc_code'); ?>
</div>