i know writing to text file seems easy but i just cant make this thing work!
its a registration form that sends 2 kinds of email and also sends the data to a text file.
the problem is, i always get parse error on the writing to text file part.
please help!
//Address error handling.
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
// Check if the form has been submitted.
if ( isset ($_POST['submit'])) {
$problem = FALSE; // No problem so far.
// Check for each value.
if (empty ($_POST['application_type'])) {
$problem = TRUE;
print '<p>Please choose an application type!</p>';
}
if (empty ($_POST['card_no'])) {
$problem = TRUE;
print '<p>Please enter your existing card no</p>';
}
if (empty ($_POST['your_name'])) {
$problem = TRUE;
print '<p>Please enter your name!</p>';
}
if (empty ($_POST['your_gender'])) {
$problem = TRUE;
print '<p>Please select your gender!</p>';
}
if (empty ($_POST['bday_month'])) {
$problem = TRUE;
print '<p>Please select your Birthday month!</p>';
}
if (empty ($_POST['bday_day'])) {
$problem = TRUE;
print '<p>Please select your Birthday day!</p>';
}
if (empty ($_POST['bday_year'])) {
$problem = TRUE;
print '<p>Please enter your Bithday year!</p>';
}
if (empty ($_POST['your_citizenship'])) {
$problem = TRUE;
print '<p>Please enter your current citizenship!</p>';
}
if (empty ($_POST['civil_status'])) {
$problem = TRUE;
print '<p>Please select your civil status!</p>';
}
if (empty ($_POST['phone_land'])) {
$problem = TRUE;
print '<p>Please enter your landline phone number!</p>';
}
if (empty ($_POST['phone_cell'])) {
$problem = TRUE;
print '<p>Please enter your mobile phone number!</p>';
}
if (empty ($_POST['your_email'])) {
$problem = TRUE;
print '<p>Please enter your email!</p>';
}
if (empty ($_POST['home_address'])) {
$problem = TRUE;
print '<p>Please enter your home address!</p>';
}
if (empty ($_POST['educ_attain'])) {
$problem = TRUE;
print '<p>Please select your educational attainment!</p>';
}
if (empty ($_POST['credit_card'])) {
$problem = TRUE;
print '<p>Please select a credit card or none!</p>';
}
if (empty ($_POST['comp_name'])) {
$problem = TRUE;
print '<p>Please enter your company name!</p>';
}
if (empty ($_POST['work_address'])) {
$problem = TRUE;
print '<p>Please enter your work address!</p>';
}
if (empty ($_POST['card_type'])) {
$problem = TRUE;
print '<p>Please select a card type!</p>';
}
if (!$problem) { // If there weren't any problems...
// print a message to the page
print '<br /><br /><font color="FF0000"><b><p>Your registration was a success. You will recieve a confirmation email shortly which contains your application reference number. Please keep this number for your easy reference. Thank You!</p></b></font>';
//Add a APPLICATION REFERENCE NUMBER
//Lets open the file as read only (r)
$_ref_no = file_get_contents("text/card_reg/ref_no.txt","r");
// Define today's date
$_date_today = date ('D M d, Y');
// Send the email to [email]membership@mysite.com[/email]
$to = "membership@mysite.com";
$subject = "{$_POST['your_name']} is applying for a mysite card";
$body = "{$_date_today} \n \n \n {$_POST['your_name']} is applying for a mysiite card \n \n \n BELOW ARE THE DETAILS OF THE CLIENT \n Application Type: {$_POST['application_type']} \n RENEWAL : Card No. {$_POST['card_no']} \n \n Complete Name: {$_POST['your_name']} \n Gender: {$_POST['your_gender']} \n Birthday: {$_POST['bday_month']} {$_POST['bday_day']}, {$_POST['bday_year']} \n Citizenship: {$_POST['your_citizenship']} \n Civil Status: {$_POST['civil_status']} \n Phone Numbers \n Landline: {$_POST['phone_land']} \n Mobile: {$_POST['phone_cell']} \n Email Address: {$_POST['your_email']} \n Home Address: {$_POST['home_address']} \n Educational Attainment: {$_POST['educ_attain']} \n Credit Card: {$_POST['credit_card']} \n Company Name: {$_POST['comp_name']} \n Company Address: {$_POST['work_address']} \n \n CARD TYPE APPLIED FOR: {$_POST['card_type']} \n \n REFERENCE NUMBER: {$_ref_no}";
mail ($to, $subject, $body, 'From: [email]membership@mysite.com[/email]');
// Send the email to the APPLICANT'S EMAIL
$to_a = "{$_POST['your_email']}";
$subject_a = "Thank You {$_POST['your_name']} for applying for a mysite card";
$body_a = "Thank You {$_POST['your_name']} for applying for a MySite {$_POST['card_type']} Privilege Card. Your application reference number is {$_ref_no} \n \nWe will contact you as soon as possible. \n \n Thank You! \n Our Team \n \n \nhttp://www.mysite.com";
mail ($to_a, $subject_a, $body_a, 'From: [email]membership@mysite.com[/email]');
// Copy the application data to the text file database
// Open the text file
$_reg_file = fopen ('text/card_reg/online.txt', 'ab')
// Store the data
$_eto_na = $_POST['your_name'];
fwrite ($_reg_file, $_eto_na);
fclose ($_reg_file); // Close the file.
} else { // Forgot a field.
print '<font color="FF0000"><b><a href="javascript:window.location.reload()" target="_top">Please click here and Try Again.</a></b></font>';
}
} //End of handle form IF.
//THE FORM FOLLOWS HERE BUT I HAVE RUNOUT OF SPACE.