PHP variable not displayed from POST

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lord
Forum Newbie
Posts: 5
Joined: Sun Nov 07, 2010 12:30 pm

PHP variable not displayed from POST

Post 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.
s992
Forum Contributor
Posts: 124
Joined: Wed Oct 27, 2010 3:06 pm

Re: PHP variable not displayed from POST

Post by s992 »

Post the code for the form that you are getting POST data from.
zaster79
Forum Newbie
Posts: 7
Joined: Tue Nov 16, 2010 9:37 am

Re: PHP variable not displayed from POST

Post by zaster79 »

Code: Select all

echo "Welcome back, $username";

Shouldn't that be ...

Code: Select all

echo "Welcome back, " . $username; 
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: PHP variable not displayed from POST

Post 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.
Post Reply