txt field and variable in php

houssam_ballout

New Member
hello all
how can I put the $username variable into the value of the text field,
it doesnt work as I want in the following code:

echo '<p> <input type="text" value="$username"></p>';
thanks
 
hello all
how can I put the $username variable into the value of the text field,
it doesnt work as I want in the following code:

echo '<p> <input type="text" value="$username"></p>';
thanks

I don't work in PHP but have you tried $username without the ""'s usually in a lot of programming languages when you quote something it gives it literal value and not what the variable holds.

are you getting any errors or any sort of output at all with your current command.
 
You have to use double quotes on your ehco statement or variables are taken as literals.

echo "<p> <input type=\"text\" value=\"$username\"></p>";
 
Back
Top