In the file at http://www.globalfreeenterprise.com/contact.php the variable $First is mentioned in the local variables section, then in the validation section, and then in the prepare body section. It is also referenced in the html form that follows the php area.
Do you mean that by including $body =“”; at the beginning of the prepare body section I prevent me from defining Body before the prepare body section? What are you referring to when you say “URL” (" . . . putting it in as a variable on the URL").
I know this must seem terribly dense on my part, but I don’t know the order in which things happen when the server executes the php and I don’t really know what each statement does in the three sections that I have mentioned. I do have a clear idea of what the html form is doing.
If you did then you would find that it is necessary to declare the variable before usage otherwise PHP will produce warnnings that the variable is not in use.
The first part of the script shows how to suppress undecalared variable warnings, the latter part of the script with the warnings showing.
$Body = ‘’;
By deleting the above line, then if the variable has not been previously declared a warning will be given. If $Body has been previously declared then it will retain the previous values and the remaining script will append additional values.
All of the lines except that one are using .= to concatenate onto the end of whatever $Body already contains. Setting it to blank first allows you to easily ament the code later to add extra fields at the start of the $Body.
If you just started it with $Body = "Name: "; then you’d need to also modify that line if you need to add something in front (to add back in the dot that changes it from assigning to the field to concatenate to it instead).
I Believe it’s a holdover from when magic-variables were being used…
Setting $body =“”; prevents someone from pre-loading Body with some text by putting it in as a variable on the URL. You could achieve the same effect by removing the . from in front of the top line of the actual body text.