PHP Variables Not Displaying

Hey all, hope everyone’s well. I was contacted by a school organization to create an online form to process their requests for a Disability Shuttle. I only knew HTML, so I taught myself the basics of PHP last weekend in order to do this. I have the form HTML and the corresponding PHP file. The user enters information into boxes on the HTML page and the PHP file sends the information to my inbox. However, in the email, only the “Name” and “email address” variables are showing, indicating that there is probably an error with the variables. However, I can’t find any discrepency (i.e. misspelled variable names) in the files. One thing I thought of was that was the phone number could be throwing things off, if there are different variable types like in C/C++.

Here are the .php file code, the .htm file code, and the resulting email I get. Thanks for any help you can give me!

.php file

[code]

<?php $EmailFrom = Trim(stripslashes($_POST['emailadd'])); $EmailTo = "[email protected]"; $Subject = "DRS Shuttle Request"; $name = Trim(stripslashes($_POST['name'])); $phonenum = Trim(stripslashes($_Post['phonenum'])); $status = Trim(stripslashes($_Post['status'])); $type = Trim(stripslashes($_Post['type'])); $duration = Trim(stripslashes($_Post['duration'])); $dayweek = Trim(stripslashes($_Post['dayweek'])); $month = Trim(stripslashes($_Post['month'])); $daymonth = Trim(stripslashes($_Post['daymonth'])); $placeup1 = Trim(stripslashes($_Post['placeup1'])); $placeoff1 = Trim(stripslashes($_Post['placeoff1'])); $timeoff1 = Trim(stripslashes($_Post['timeoff1'])); $placeup2 = Trim(stripslashes($_Post['placeup2'])); $placeoff2 = Trim(stripslashes($_Post['placeoff2'])); $timeoff2 = Trim(stripslashes($_Post['timeoff2'])); $placeup3 = Trim(stripslashes($_Post['placeup3'])); $placeoff3 = Trim(stripslashes($_Post['placeoff3'])); $timeoff3 = Trim(stripslashes($_Post['timeoff3'])); $placeup4 = Trim(stripslashes($_Post['placeup4'])); $placeoff4 = Trim(stripslashes($_Post['placeoff4'])); $timeoff4 = Trim(stripslashes($_Post['timeoff4'])); $placeup5 = Trim(stripslashes($_Post['placeup5'])); $placeoff5 = Trim(stripslashes($_Post['placeoff5'])); $timeoff5 = Trim(stripslashes($_Post['timeoff5'])); $validationOK=true; if (Trim($EmailFrom)=="") $validationOK=false; if (!$validationOK) { print ""; exit; } $Body = ""; $Body .= "Name: "; $Body .= $name; $Body .= "n"; $Body .= "Email Address: "; $Body .= $EmailFrom; $Body .= "n"; $Body .= "Phone Number: "; $Body .= $phonenum; $Body .= "n"; $Body .= "University Status: "; $Body .= $status; $Body .= "n"; $Body .= "Nature of the Disability: "; $Body .= $nature; $Body .= "n"; $Body .= "Duration Time: "; $Body .= $duration; $Body .= "n"; $Body .= "Date: "; $Body .= $dayweek; $Body .= " "; $Body .= $month; $Body .= " "; $Body .= $daymonth; $Body .= "n"; $Body .= "Pick Up Location (1): "; $Body .= $placeup1; $Body .= "n"; $Body .= "Drop Off Location (1): "; $Body .= $placeoff1; $Body .= "n"; $Body .= "Drop Off Time (1): "; $Body .= $timeoff1; $Body .= "n"; $Body .= "Pick Up Location (2): "; $Body .= $placeup2; $Body .= "n"; $Body .= "Drop Off Location (2): "; $Body .= $placeoff2; $Body .= "n"; $Body .= "Drop Off Time (2): "; $Body .= $timeoff2; $Body .= "n"; $Body .= "Pick Up Location (3): "; $Body .= $placeup3; $Body .= "n"; $Body .= "Drop Off Location (3): "; $Body .= $placeoff3; $Body .= "n"; $Body .= "Drop Off Time (3): "; $Body .= $timeoff3; $Body .= "n"; $Body .= "Pick Up Location (4): "; $Body .= $placeup4; $Body .= "n"; $Body .= "Drop Off Location (4): "; $Body .= $placeoff4; $Body .= "n"; $Body .= "Drop Off Time (4): "; $Body .= $timeoff4; $Body .= "n"; $Body .= "Pick Up Location (5): "; $Body .= $placeup5; $Body .= "n"; $Body .= "Drop Off Location (5): "; $Body .= $placeoff5; $Body .= "n"; $Body .= "Drop Off Time (5): "; $Body .= $timeoff5; $Body .= "n"; $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); if ($success){ print ""; } else{ print ""; } ?> [/code]

.htm file

[code]

DRS - Request a Shuttle
Your Name:
Your Email Address:
Your Phone Number:
Your University Status: StudentStaffFaculty
What is the Nature of the Disability You Have?:
What is the Estimated Duration For Which You Need the Shuttle?:
What Date Is the Shuttle Needed?: Monday Tuesday Wednesday Thursday Friday January February March April May June July August September October November December 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

From Where Do You Need to be Picked Up?:
Where Do You Need to be Dropped Off?:
When Do You Need to be Dropped Off?: 7:30 am 8:00 am 8:30 am 9:00 am 9:20 am 9:40 am 10:00 am 10:20 am 10:40 am 11:00 am 11:20 am 11:40 am 12:00 pm 12:20 pm 12:40 pm 1:00 pm 1:20 pm 1:40 pm 2:00 pm 2:40 pm 3:30 pm 4:00 pm 4:30 pm 5:00 pm 5:30 pm 6:00 pm 7:00 pm 7:30 pm 8:00 pm 8:30 pm 9:00 pm

From Where Do You Need to be Picked Up?:
Where Do You Need to be Dropped Off?:
When Do You Need to be Dropped Off?: 7:30 am 8:00 am 8:30 am 9:00 am 9:20 am 9:40 am 10:00 am 10:20 am 10:40 am 11:00 am 11:20 am 11:40 am 12:00 pm 12:20 pm 12:40 pm 1:00 pm 1:20 pm 1:40 pm 2:00 pm 2:40 pm 3:30 pm 4:00 pm 4:30 pm 5:00 pm 5:30 pm 6:00 pm 7:00 pm 7:30 pm 8:00 pm 8:30 pm 9:00 pm

From Where Do You Need to be Picked Up?:
Where Do You Need to be Dropped Off?:
When Do You Need to be Dropped Off?: 7:30 am 8:00 am 8:30 am 9:00 am 9:20 am 9:40 am 10:00 am 10:20 am 10:40 am 11:00 am 11:20 am 11:40 am 12:00 pm 12:20 pm 12:40 pm 1:00 pm 1:20 pm 1:40 pm 2:00 pm 2:40 pm 3:30 pm 4:00 pm 4:30 pm 5:00 pm 5:30 pm 6:00 pm 7:00 pm 7:30 pm 8:00 pm 8:30 pm 9:00 pm

From Where Do You Need to be Picked Up?:
Where Do You Need to be Dropped Off?:
When Do You Need to be Dropped Off?: 7:30 am 8:00 am 8:30 am 9:00 am 9:20 am 9:40 am 10:00 am 10:20 am 10:40 am 11:00 am 11:20 am 11:40 am 12:00 pm 12:20 pm 12:40 pm 1:00 pm 1:20 pm 1:40 pm 2:00 pm 2:40 pm 3:30 pm 4:00 pm 4:30 pm 5:00 pm 5:30 pm 6:00 pm 7:00 pm 7:30 pm 8:00 pm 8:30 pm 9:00 pm

From Where Do You Need to be Picked Up?:
Where Do You Need to be Dropped Off?:
When Do You Need to be Dropped Off?: 7:30 am 8:00 am 8:30 am 9:00 am 9:20 am 9:40 am 10:00 am 10:20 am 10:40 am 11:00 am 11:20 am 11:40 am 12:00 pm 12:20 pm 12:40 pm 1:00 pm 1:20 pm 1:40 pm 2:00 pm 2:40 pm 3:30 pm 4:00 pm 4:30 pm 5:00 pm 5:30 pm 6:00 pm 7:00 pm 7:30 pm 8:00 pm 8:30 pm 9:00 pm

Do You Have Any Other Additional Comments?:
[/code]

Resulting email:

Name: Michael Ramella Email Address: [email protected] Phone Number: University Status: Nature of the Disability: Duration Time: Date: Pick Up Location (1): Drop Off Location (1): Drop Off Time (1): Pick Up Location (2): Drop Off Location (2): Drop Off Time (2): Pick Up Location (3): Drop Off Location (3): Drop Off Time (3): Pick Up Location (4): Drop Off Location (4): Drop Off Time (4): Pick Up Location (5): Drop Off Location (5): Drop Off Time (5):

MOD EDIT: Added code tags

First of all, please use the [code] tags, keeps the pages short and the code distinquishable.

To solve your problem, this link should suffice:
variables

Variables are case-sensitive, which includes superglobals such as $_POST. Starting from $phonenum, you’re trying to fetch values from $_Post. Hence the empty variables.

Also, I see you use Trim(). Functions are not case-sensitive, but it’s good practice to use the correct case for functions and classes as well. This to prevent issues in the future.

Thank you very much, and I’m sorry about not using Code, in the future I will be sure to do!

Your help was greatly appreciated.

Sponsor our Newsletter | Privacy Policy | Terms of Service