Help with PHP code radio buttons not working in email
Posted: Fri Jul 12, 2013 11:36 am
First a disclaimer; I am so not a web developer or any sort of computer guru. I am the Human Resources/payroll person for the small company that I work for, and somehow have gotten stuck the last few years doing their websites despite all of my kicking and screaming. That said, please excuse my ignorance on these matters, I have tried to teach myself what I can, but I know I am far from being "good" and I'm sure I've made alot of errors along the way that would probably make most of you laugh me out of the room.
The latest project that has been thrust upon me is to try to get an online form working that can be submitted with the results via email. I have managed to get most of the form elements working, but some of the radio buttons are giving me fits. I've been working on this for 2 days and just can't figure out where I'm going wrong, so I'm begging for some help from those more knowledgeable than myself. Hopefully I get the code posted correctly below:
Here is my code on my webpage for the form:
[text]
<form id="form1" name="form1" action="send-email-volunteer-activity-form.php" method="post">
<div align="left"><a name="TemplateInfo"></a>
</div>
<h1 align="left">Volunteer Activity Form</h1>
<p align="left">Current Desert Oasis Hospice Volunteers can now submit your Volunteer Activity Forms online.<br />
<br />
Volunteer Name: <input name="volunteer_name" id="volunteer_name" type="text" value="" size="50" maxlength="50"><br>
Patient's Initials: <input name="patients_initials" id="patients_initials" type="text" size="50" maxlength="50"><br>
Visit Date: <input name="visit_date" id="visit_date" type="text" size="50" maxlength="50"><br><br>
<strong>REMEMBER:</strong><br>
Documentation of your activity should be turned in within 48 hours of your visit to the Volunteer Coordinator.<br><br>
<strong>Type of Service:</strong><br>
<input type="radio" name="type_of_service" id="type_of_service" value="visit">Visit<br>
<input type="radio" name="type_of_service" id="type_of_service" value="refused_visit">Refused Visit<br>
<input type="radio" name="type_of_service" id="type_of_service" value="administrative_support">Administrative Support<br>
<input type="radio" name="type_of_service" id="type_of_service" value="bereavement">Bereavement<br>
<input type="radio" name="type_of_service" id="type_of_service" value="treasure_chest_volunteer">Treasure Chest Volunteer<br>
<input type="radio" name="type_of_service" id="type_of_service" value="volunteer_training">Volunteer Training<br>
<input type="radio" name="type_of_service" id="type_of_service" value="inservice_meeting">In-Service/meeting<br>
Other: <input type="text" name="type_of_service" id="type_of_service" value="" size="100" maxlength="150"><br />
<br />
<strong>Services Provided:</strong><br>
<input type="radio" name="services_provided" id="services_provided" value="patient_support_companionship">Patient Support/Companionship<br>
<input type="radio" name="services_provided" id="services_provided" value="caregiver_support_companionship">Caregiver support/companionship<br>
<input type="radio" name="services_provided" id="services_provided" value="provided_music">Provided Music<br>
<input type="radio" name="services_provided" id="services_provided" value="crafts">Crafts<br>
Other: <input type="text" name="services_provided" id="services_provided" value="" size="100" maxlength="150"><br />
<br>
<strong>Hours Worked: </strong><br>
Start Time:<input name="hours_worked_start_time" id="hours_worked_start_time" type="text" value="" size="10" maxlength="10"> <input type="radio" name="start_time" id="start_time" value="AM" />AM <input type="radio" name="start_time" id="start_time" value="PM" />PM
<br />
End Time: <input name="hours_worked_end_time" id="hours_worked_end_time" type="text" value="" size="10" maxlength="10"> <input type="radio" name="end_time" id="end_time" value="AM" />AM <input type="radio" name="end_time" id="end_time" value="PM" />PM<br>
<br><br>
<strong>Total Time Including Travel Time:</strong> (round to quarter hour)
<input name="total_time" id="total_time" type="text" value="" size="20" maxlength="20"><br>
<br><br>
<strong>Observations/Concerns/Comments: </strong>(for urgent issues please call 602-424-4204 immediately)<br>
<textarea name="observations_concerns_comments" id="observations_concerns_comments" cols="100" rows="30" wrap="hard"></textarea><br />
<br />
<strong> Volunteer's Signature:</strong> <font size="-2">(By typing your full name here, this acts as your signature in an electronic version)</font>
<input name="volunteer_signature" id="volunteer_signature" type="text" value="" size="50" maxlength="50">
Date: <input name="date_signed" id="date_signed" type="text" value="" size="20" maxlength="20"><br><br />
<br />
<br />
<input type="submit" name="submit" id="sumbit" value="Send" />
</form>
[/text]
And here is my PHP send mail code:
And here is what my emails look like:
[text]Volunteer Activity Form
Volunteer Name Jane Smith
Patient Initials WB
Visit Date 7/5/13
Services:
Type of Service
Services Provided
Hours Worked:
Start Time 4:00 PM
End Time 4:30 PM
Total time including travel time 0.5
Observations/Concerns/Comments:
Comments: none
Volunteer Signature:
Volunteers Signature: (By typing your full name here, this acts as your signature in an electronic version) Jane Smith
Date Signed 7/12/13
[/text]
So you can see my radio buttons for the AM/PM time are working in the email, but the radio buttons for "type of service" and "services provided" are not.
HELP! What am I doing wrong?
Thank you greatly in advance!!
The latest project that has been thrust upon me is to try to get an online form working that can be submitted with the results via email. I have managed to get most of the form elements working, but some of the radio buttons are giving me fits. I've been working on this for 2 days and just can't figure out where I'm going wrong, so I'm begging for some help from those more knowledgeable than myself. Hopefully I get the code posted correctly below:
Here is my code on my webpage for the form:
[text]
<form id="form1" name="form1" action="send-email-volunteer-activity-form.php" method="post">
<div align="left"><a name="TemplateInfo"></a>
</div>
<h1 align="left">Volunteer Activity Form</h1>
<p align="left">Current Desert Oasis Hospice Volunteers can now submit your Volunteer Activity Forms online.<br />
<br />
Volunteer Name: <input name="volunteer_name" id="volunteer_name" type="text" value="" size="50" maxlength="50"><br>
Patient's Initials: <input name="patients_initials" id="patients_initials" type="text" size="50" maxlength="50"><br>
Visit Date: <input name="visit_date" id="visit_date" type="text" size="50" maxlength="50"><br><br>
<strong>REMEMBER:</strong><br>
Documentation of your activity should be turned in within 48 hours of your visit to the Volunteer Coordinator.<br><br>
<strong>Type of Service:</strong><br>
<input type="radio" name="type_of_service" id="type_of_service" value="visit">Visit<br>
<input type="radio" name="type_of_service" id="type_of_service" value="refused_visit">Refused Visit<br>
<input type="radio" name="type_of_service" id="type_of_service" value="administrative_support">Administrative Support<br>
<input type="radio" name="type_of_service" id="type_of_service" value="bereavement">Bereavement<br>
<input type="radio" name="type_of_service" id="type_of_service" value="treasure_chest_volunteer">Treasure Chest Volunteer<br>
<input type="radio" name="type_of_service" id="type_of_service" value="volunteer_training">Volunteer Training<br>
<input type="radio" name="type_of_service" id="type_of_service" value="inservice_meeting">In-Service/meeting<br>
Other: <input type="text" name="type_of_service" id="type_of_service" value="" size="100" maxlength="150"><br />
<br />
<strong>Services Provided:</strong><br>
<input type="radio" name="services_provided" id="services_provided" value="patient_support_companionship">Patient Support/Companionship<br>
<input type="radio" name="services_provided" id="services_provided" value="caregiver_support_companionship">Caregiver support/companionship<br>
<input type="radio" name="services_provided" id="services_provided" value="provided_music">Provided Music<br>
<input type="radio" name="services_provided" id="services_provided" value="crafts">Crafts<br>
Other: <input type="text" name="services_provided" id="services_provided" value="" size="100" maxlength="150"><br />
<br>
<strong>Hours Worked: </strong><br>
Start Time:<input name="hours_worked_start_time" id="hours_worked_start_time" type="text" value="" size="10" maxlength="10"> <input type="radio" name="start_time" id="start_time" value="AM" />AM <input type="radio" name="start_time" id="start_time" value="PM" />PM
<br />
End Time: <input name="hours_worked_end_time" id="hours_worked_end_time" type="text" value="" size="10" maxlength="10"> <input type="radio" name="end_time" id="end_time" value="AM" />AM <input type="radio" name="end_time" id="end_time" value="PM" />PM<br>
<br><br>
<strong>Total Time Including Travel Time:</strong> (round to quarter hour)
<input name="total_time" id="total_time" type="text" value="" size="20" maxlength="20"><br>
<br><br>
<strong>Observations/Concerns/Comments: </strong>(for urgent issues please call 602-424-4204 immediately)<br>
<textarea name="observations_concerns_comments" id="observations_concerns_comments" cols="100" rows="30" wrap="hard"></textarea><br />
<br />
<strong> Volunteer's Signature:</strong> <font size="-2">(By typing your full name here, this acts as your signature in an electronic version)</font>
<input name="volunteer_signature" id="volunteer_signature" type="text" value="" size="50" maxlength="50">
Date: <input name="date_signed" id="date_signed" type="text" value="" size="20" maxlength="20"><br><br />
<br />
<br />
<input type="submit" name="submit" id="sumbit" value="Send" />
</form>
[/text]
And here is my PHP send mail code:
Code: Select all
<?php
// loop through every form field
/*
while( list( $field, $value ) = each( $_POST )) {
// display values
if( is_array( $value )) {
// if checkbox (or other multiple value fields)
while( list( $arrayField, $arrayValue ) = each( $value ) ){
echo "<p>' . $arrayValue . '</p>\n";
}
} else {
echo "<p>' . $value . '</p>\n";
}
}
*/
$email_message = "" ;
$email_message .= '<h2>Volunteer Activity Form </h2>';
$email_message .= '<table width="600" border="0" cellspacing="0" cellpadding="0">';
$email_message .= '<tr>';
$email_message .= '<td width="168" align="left" valign="top"> </td>';
$email_message .= '<td width="46" align="left" valign="top"> </td>';
$email_message .= '<td width="386" align="left" valign="top"> </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">Volunteer Name </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top">' . $_POST['volunteer_name'] . ' </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">Patient Initials </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top">' . $_POST['patients_initials'] . '</td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">Visit Date </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top">' . $_POST['visit_date'] . ' </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td colspan="3" align="left" valign="top"><h3>Services:</h3></td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">Type of Service</td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top">';
$email_message .= $_POST['type_of_service'] ;
$email_message .= '</td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">Services Provided</td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top">' . $_POST['services_provided'] . ' </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td colspan="3" align="left" valign="top"><h3>Hours Worked:</h3></td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">Start Time</td>';
$email_message .= '<td align="left" valign="top">' . $_POST['hours_worked_start_time'] . '</td>';
$email_message .= '<td align="left" valign="top">' . $_POST['start_time'] . '</td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">End Time</td>';
$email_message .= '<td align="left" valign="top">' . $_POST['hours_worked_end_time'] . '</td>';
$email_message .= '<td align="left" valign="top">' . $_POST['end_time'] . '</td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">Total time including travel time</td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top">' . $_POST['total_time'] . ' </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td colspan="3" align="left" valign="top"><h3>Observations/Concerns/Comments:</h3></td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">Comments:</td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top">' . $_POST['observations_concerns_comments'] . ' </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td colspan="3" align="left" valign="top"><h3>Volunteer Signature:</h3></td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td colspan="2" align="left" valign="top">Volunteers Signature: (By typing your full name here, this acts as your signature in an electronic version)</td>';
$email_message .= '<td align="left" valign="top">' . $_POST['volunteer_signature'] . ' </td>';
$email_message .= '</tr>';
$email_message .= '<tr>';
$email_message .= '<td align="left" valign="top">Date Signed</td>';
$email_message .= '<td align="left" valign="top"> </td>';
$email_message .= '<td align="left" valign="top">' . $_POST['date_signed'] . ' </td>';
$email_message .= '</tr>';
$email_message .= '</table>';
// EDIT THE 2 LINES BELOW AS REQUIRED
// $email_to = "ejaehnig@geriatricsolutionsllc.com";
$email_to = "test@desertoasishospice.com";
$email_subject = "Volunteer Activity Form";
$email_from = "test@desertoasishospice.com";
// create email headers
$headers = 'From: '.$email_from."\r\n".
$headers .= "Content-type: text/html\r\n";
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
// success. sends you to the thank you pge
header( 'Location: /volunteeractivityformsubmission.htm' ) ;
?>
<!-- include your own success html here -->
Thank you for submitting your Volunteer Activity Form. We greatly appreciate your continued service to Desert Oasis Hospice patients and their families!
[text]Volunteer Activity Form
Volunteer Name Jane Smith
Patient Initials WB
Visit Date 7/5/13
Services:
Type of Service
Services Provided
Hours Worked:
Start Time 4:00 PM
End Time 4:30 PM
Total time including travel time 0.5
Observations/Concerns/Comments:
Comments: none
Volunteer Signature:
Volunteers Signature: (By typing your full name here, this acts as your signature in an electronic version) Jane Smith
Date Signed 7/12/13
[/text]
So you can see my radio buttons for the AM/PM time are working in the email, but the radio buttons for "type of service" and "services provided" are not.
HELP! What am I doing wrong?
Thank you greatly in advance!!