This is why there is a sticky thread harping on code format. Aside from the lack of readability, the error you are recieving is usually due to an un-closed loop or conditional statement. This can usually be easily avoided if you use and align opening and closing brackets.
I refuse to go over your entire code, but here is an example of how it might look with properly formatted brackets:
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
{
...?>
Do you see where this is going? If you bury your endifs and endfors, then you risk the unexpected $end issue. The code formatting should help you avoid such problems.
One other suggestion on readability: if you've got to throw some html around some PHP output, just add it to your echo string. You'll find that it is much leaner and cleaner than jumping in and out of PHP constantly.
Example (notice how single & double-quotes can be nested):
<?php
if (!empty($error))
{
echo '<div class="error">';
if (!empty($error['transaction']))
echo "<h3>".$error['transaction']."</h3>";
}
else
{
...
?>
Note: I'm not even sure I placed the brackets where they should be, but note how I skip the brackets ONLY when there is only one statement to execute. Otherwise, I'd stick with the bracket concept.