Re: Joining fixed text to a SUBJECT variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2-3-2013 12:23, Lester Caine wrote:
Michael CALDER wrote:
$Subject = "RVRA Contact Form - ,$MessageSubject";

Can anyone please advise or point me in the right direction for
instructions on how to combine the fixed text with the variable
$MessageSubject.

The quick fix is simply
$Subject = "RVRA Contact Form - ".$MessageSubject;

but
$Subject = "RVRA Contact Form - ,$MessageSubject";
should work, what is the error? ... you don't actually want the ','

$Subject = "RVRA Contact Form - $MessageSubject";
Should work as well


No it shouldn't, unless you have register_globals turned On. Which most hosts don't (and shouldn't) do.

The problem is the simple fact that the variable $MessageSubject is not defined until 4 lines farther into the script. Changing the variable to $_POST['MessageSubject'] (and concatenating using the concatenation operator (the period: '.' )) should fix this for you.

If Michael had E_NOTICE errors turned on, he would see an E_NOTICE: "Undefined variable" on line 6. Apparently, he doesn't show E_NOTICEs either.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux