PHP form processing problem
Posted on 2003-02-25
My web server admin recently decided to upgrade PHP on server and disable old form field variable access. So I have to use the new method which I believe is $_POST['field'] instead of $field for the POST submission method.
However, I encounter this error when I changed my code:
PHP Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\Documents and Settings\dluu\Desktop\scholarship\$test.txt on line 12
Here is my PHP code:
// Developed by David Luu for the EE Dept.
// Questions/Comments Contact firstname.lastname@example.org
// This script for sending application to EE email address.
//Recepient Email address for application submissions.
$send_to = "email@example.com, firstname.lastname@example.org, email@example.com";
/* $message is a variable containing the entire form data. The PHP code below combines the data of each form field into the message variable. Each name with a $ preceding it is a variable that is linked to its form field name and will be inserted where it is listed in the code below. \n = new line, \t = tab.
$message = "Name: $_POST['FirstName'] $_POST['MiddleName'] $_POST['LastName']\nSSN: $_POST['SSN']\nHigh School Attended: $_POST['highschool']\nGPA: $_POST['GPA']\nSAT Score: $_POST['SAT']\nIntended Major: $_POST['major']\nEmail: $_POST['submit_by']\nAddress:\n$_POST['Street']\n$_POST['City'], $_POST['State'] $_POST['Zip']\nPhone: $_POST['AreaCode']-$_POST['Telephone']\n\nPersonal Statement:\n$_POST['personalSt']\n";
/* mail("firstname.lastname@example.org", "Subject", "message", "From: email@example.com");
In the code below, "message" is replaced with the $message variable and the return email is replaced with the $submit_by variable.
/* All scholarship submissions should be sent with the appropriate subject heading such as the one given below. */
mail($send_to, "SVE Scholarship Application", $message, "From: $_POST['submit_by']");
Off hand, I can't tell the source of the problem. Can someone point out my error.