Thank you for your two posts. I tried what you suggested.
I don’t get an error message whether I include ini_set(‘display_errors’, ‘on’); or not and I don’t get any error messages whether I include $Body = ‘’; or not , nor in any combination.
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.
To be straight to the point, the following line just initializes your $Body variable with empty value:
$Body = "";
So whatever you assign with the $Body variable before this line will be deleted/removed and variable will be made empty. So whatever you want to put with this variable you must do after this line.
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.
To some place in the middle of the list, how does the $Body = “”; help me?
That section is labeled
// prepare email body text
That indicates to me that this section is determining what the sent email looks like as to its content and the order in which it is presented to the recipient. Is that right?
I don’t have any idea what each of these three lines