Thanks for your help.
I'll try to bring in more of the code and try to explain what's going on. I may snip some to ease reading. I appreciate you wading through my code.
<form id="reg_form" action="" method="post">
Here's the first part of meat:
if(!db_connect($db, $error_array['db']))
{
echo '<tr><td colspan="3" class="error">We are experiencing technical difficulties. Please try again later.</td></tr>';
mail_admin($self_file, $error_array['db']);
}
else
{
//First check for how many banquets remain to
//decide what messages to feed to user
if(count_banquet($db, $count, $error_message))
{
$max_banquet = 200;
if($count < $max_banquet)
{
$price[1] = 79;
$price[2] = 89;
$price[3] = 99;
$banquet_full = false;
$registration_input_name = 'number_registrations';
$banquet_remain = $max_banquet - $count;
$registration_note = '<span class="note">Only '.$banquet_remain.' banquet seats left. Register today!</span>';
}
else
{
$price[1] = 40;
$price[2] = 50;
$price[3] = 60;
$banquet_full = true;
$registration_input_name = 'number_registrations_no_banquet';
$registration_note = '<span class="note">Banquet is full. Registration includes sessions and proceedings only.</span>';
}
}
else
{
trigger_error($error_message, E_USER_ERROR);
}
//Here's where the form is validated
if(isset($_POST) && !empty($_POST)){
if(!validate_data($db, $_POST, $cutoff, $price,'normal', $error_array))
{
if(isset($error_array) && !empty($error_array))
{
echo '<tr><td colspan="3" class="error">Please see error(s) below.</td></tr>';
}
}
else
{
// Here's where the data is then inserted to the db
if(!insert_data($db, $_POST, $error_array['insert']))
{
echo '<tr><td class="error" colspan="2">We are experiencing technical difficulties. Please try again later.</td></tr>';
mail_admin($self_file, $error_array['insert']);
}
else
{
$registration_successful = true;
unset($error_array['insert']);
echo '<tr><td class="success">Your registration for the MUD conference has been accepted.</td></tr>';
echo '<tr><td align="center">Print a copy for your records</td></tr>';
}
}
if(!close_db($db, $error_array))
{
mail_admin($self_file, $error_array['db']);
}
else
{
//I added this
echo '<tr><td class="success">The Database did, in fact, close.</td></tr>';
}
}
}
//
//Here's where I get frustrated. It just successfully wrote to the db and closed it
//so $registration_successful has to be true
//Yet, here's where all the variables are unrecognized in this next stretch
//Not sure if the $registration_successful variable is unrecognized--don't recall
//
if($registration_successful)
{
//
//Message is built up for sending to the emailer routine
//
$email_message = 'Dear '.$first_name.' '.$last_name.','."\n";
$email_message.= 'Your registration has been accepted for the MUD 2007 conference.'."\n";
$email_message.= 'The information you submitted is as follows:'."\n";
$email_message.= $call_sign."\n".
$first_name.' '.$last_name."\n".
$street.
$street_2."\n".
$city.', '.$state.' '.$country.' '.$postal_code."\n".
$phone."\n".
$email."\n".
'Name Tag: '.$nametag."\n";
//
//snip a bunch of checking deciding what
//personalized message to send user about banquets
//
$email_message.='Total Due to Microwave Update $'.money_format('%n', $total)."\n".
'Payment for $'.money_format('%n',$_POST['total']).' will be accepted by."\n".
Microwave Update, via PayPal, at some weblink
or by check, payable to:
Microwave Update
Send to: Someguy
Some address
Some address'."\n\n".
'See you in Bloomington, MN in October!
Your Microwave Update Hosts';
//
//Here a message is built up for display on the screen
//Admittedly, it could be these variables that are showing as undefined
//
$message = '<tr><td>'.$call_sign.'</td></tr>
<tr><td>'.$first_name.' '.$last_name.'</td></tr>
<tr><td>'.$street.'</td></tr>
<tr><td>'.$street_2.'</td></tr>
<tr><td>'.$city.', '.$state.' '.$country.' '.$postal_code.'</td></tr>
<tr><td>'.$phone.'</td></tr>
<tr><td>'.$email.'</td></tr>
<tr><td>Name Tag: '.$nametag.'</td></tr>';
//
//snip a bunch of checking deciding what
//personalized message to send user about banquets
//
$message.='<tr><td>Total Due to the Microwave Update <strong>$'.money_format('%n', $total).'</strong></td></tr>
<tr><td>You can pay $'.money_format('%n',$_POST['total']).' by PayPal, at <a href="http://www.microwaveupdate.org/index.php">MUD</a></td></tr>
<tr><td>You can also pay by check, payable to:<br />
Microwave Update<br />
Send to: Some guy<br />
Some Address <br />
Some address<br /></td></tr>
<tr><td class="success">See you in Bloomington, MN in Oct!</td></tr>
<tr><td colspan="3" class="note">Note: Both registration and payment must be received(or post marked) by the date to recieve discounted price.</td></tr>';
$message.= '<tr><td><a href="registered_attendees.php">See who is registered to come</a></td></tr>';
// Is the next line the one that is dumping all the variables?
//I can see it dumping the post variables but haven't I read them
//out to my own variables?
$_POST = array();
//Display the big message on the screen
echo $message;
//
//The following is always coming back failing mostly because the $email variable
//is empty or not defined at this point
//
if(send_success_email($email, $email_message))
{
echo '<tr><td>A confirmation email has been sent to the email address you submitted</td></tr>';
}
else
{
echo '<tr><td>Please print this page for your reference. Sending of email failed.</td.</tr>';
mail_admin($self_file, 'FAILED TO SEND EMAIL to registrant '.$callsign);
}
}
else
{
if(isset($error_array['db']))
{
echo 'database problem';
echo '<tr><td colspan="3">Database problem '.$error_array['db'].'</td></tr>';
}
?>
This is followed by the HTML/PHP mix of the actual form with a sample:
<tr><th colspan="3" align="center">Name and Call Sign</th></tr>
<tr><td align="right"><span class="required">*</span> Call:</td><td colspan="2"><input type="text" name="call_sign" value="<?php echo (isset($_POST['call_sign'])?$_POST['call_sign']:''); ?>" /></td></tr>
<?php
echo (isset($error_array['call_sign'])?'<tr><td colspan="3" class="error">'.$error_array['call_sign'].'</td></tr>':'');
?>
<tr><td align="right"><span class="required">*</span> First Name:</td><td colspan="2"><input type="text" name="first_name" value="<?php echo (isset($_POST['first_name'])?$_POST['first_name']:''); ?>" /></td></tr>
<?php
echo (isset($error_array['first_name'])?'<tr><td colspan="3" class="error">'.$error_array['first_name'].'</td></tr>':'');
?>
<tr><td align="right"><span class="required">*</span> Last Name:</td><td colspan="2"><input type="text" name="last_name" value="<?php echo (isset($_POST['last_name'])?$_POST['last_name']:''); ?>" /></td></tr>
<?php
echo (isset($error_array['last_name'])?'<tr><td colspan="3" class="error">'.$error_array['last_name'].'</td></tr>':'');
?>
Ya know, I'll admit to being hazy on where the $POST variables are really being read to my local variables. I'll have to look harder for that. I can see the validation routine is handed the entire $POST array.
I'll send along my functions if they would help.
Many thanks again for your time looking.
Bruce