Page 1 of 1

PHP variable not displayed from POST

Posted: Fri Dec 03, 2010 12:33 pm
by lord

Code: Select all

			
		$username = $_POST["username"];
		$useremail = $_POST["useremail"];
		
                $test_string = "billy";

		echo "Welcome back, $username"; //displays Welcome back,

                echo "Welcome back, $test_string"; //displays Welcome back, billy
Anyone help me as to why my variables from POST are not being displayed?
Thank you very much.

Re: PHP variable not displayed from POST

Posted: Fri Dec 03, 2010 12:55 pm
by s992
Post the code for the form that you are getting POST data from.

Re: PHP variable not displayed from POST

Posted: Fri Dec 03, 2010 1:00 pm
by zaster79

Code: Select all

echo "Welcome back, $username";

Shouldn't that be ...

Code: Select all

echo "Welcome back, " . $username; 

Re: PHP variable not displayed from POST

Posted: Fri Dec 03, 2010 1:54 pm
by Celauran
zaster79 wrote:

Code: Select all

echo "Welcome back, $username";

Shouldn't that be ...

Code: Select all

echo "Welcome back, " . $username; 
Both will work fine, as will

Code: Select all

echo "Welcome back, {$username}";
OP, you haven't given us enough to work with.