<?php $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $age = $_POST['age']; $location = $_POST['location']; $favorites = $_POST['favorites']; $username = $_POST['username']; $verifyusername = $_POST['verifyusername']; $password = $_POST['password']; $verifypassword = $_POST['verifypassword']; $to = "firstname.lastname@example.org"; $subject = "freelance businessman!"; $body = " First Name: $firstname Last Name: $lastname Age: $age\n"; foreach ($_POST['choices'] as $choices) $body .= "Choices: $choices\n"; $body .= "Location: $location Favorites: $favorites Username: $username Verify Username: $verifyusername Password: $password Verify Password: $verifypassword "; ?>I have to know some things can someone break down the whole section
Age: $age\n"; foreach ($_POST['choices'] as $choices) $body .= "Choices: $choices\n"; $body .= "Location: $locationI know what a foreach statement is. I am confused as to a few things here.
1. The \n I heard was a line feed, when I originally started with php I used this and got errors, replaced it always with <br /> after that and it worked fine. When he gave me this code, I took out the \n and put <br /> and it didn't work, i tried \n and it did and my jaw hit the floor. What is this, how does it work, and like this person here, when I do learn when to use \n, and when do I learn not too. For instance I don't think this could have been done without the \n.
2. Then he put a $body, in the middle of mybody I tried taking it out but it messed it up, why does he have that there, that is my variable named $body, he called it and said
$body .= Choices: $choices\nand then did that with location, why did he use the same variable that it was inside of what did $body = whatever do in those 2 places to fix my script. I don't understand this.
3. and last I see he used .= in 2 places on the script. I don't understand this, I searched all over, and searched the operators .= doesn't exist, yet it still worked, I know I am missing something I just need help figuring out what, I only ask questions on this forum, after running through dozens of tutorials and trying things out for myself for awhile, I dissected this entire code, it does not work at all unless all the elements he put in there are exactly the way he put them on, this confuses me as to all thes eelements to this script section are vital yet I understand very little ot it. Thanks for the help
Side question-isn't as important but I was wondering when I set up that array it comes up when the thing is checked, then in the email it has the value name, is there anyway to have it say the sentence I have before the value.
By the way the website if you are wondering where the form is, it's at
it's only a test, while I lerarn all this stuff and to style the form. Thanks and the first 3 questions are critical, thanks again.