Hi Everyone,
I am new to the forum. I have been up the last couple nights fighting with what seems to be a simple task and I am having no luck. As I am fairly new to PHP, I figured one of you PHP Gurus out there could point out my mistake.
So I have a PHP page (website contact form). The form starts with the PHP section at the top where I call to some includes such as..
<?php
//page full of static variable I repeatedly use through the page and the site
require_once('./include/variables.php');
//page of functions used for validation in the contact form.
require_once('./include/functions.php');
?>
Then comes the HTML potion of the form ( I wont list it all here, but assume a webpage format). In one of the div's, I have an conditional If/Else statement. It will output/echo if the validation portion of the form has errors. That portion is as follows:
<?php
if (count($errors) > 0){
echo "<span class=\"redcolor\">There were some errors in the info you tried to submit blah blah blah. Please try the form again blah blah blah. You may also email directly to contact@".$DomainName." if you are unable to use this form. Thank you.</span>";
}
?>
.... and then of course the rest of the HTML page.
Now the problem seem to lie in the echo where I am concatenating with the variable $DomainName. The error statement echo shows on the screen, but is missing what should be where the variable is. So the output look like this on the screen....... There were some errors in the info you tried to submit blah blah blah. Please try the form again blah blah blah. You may also email directly to contact@ if you are unable to use this form. Thank you.
Now I figured the variable was not setting so I decide to test this by echo'ing the same variable in other parts of the HTML page such as in the meta tag, and image alt tag, and a div on the footer using <?php echo $DomainName; ?>. So I checked the page source in my browser and sure enough, the variable for $DomainName comes up everywhere except in the one echo for my error statement.
I figured it has to be something basic I am missing such as a semicolon, braces, bracket, parentheses or something. However, I am just not getting it. Anyone who can share some thoughts would be great!