01hanstu Posted March 13, 2012 Share Posted March 13, 2012 Hi, I am trying to get the form field to echo a php variable. The problem is that the form is 'Printed' via php. print "<td width=\"300\" valign=\"top\"><input type=\"text\" name=\"usr\" value=\"i.e. JBloggs \" onfocus=\"if(!this._haschanged){this.value=''};this._haschanged=true;\" tabindex=\"1\"></td>"; Instead of the value being i.e. JBloggs have it echo the $name variable. Any input would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/258848-php-echo-within-a-print/ Share on other sites More sharing options...
smerny Posted March 13, 2012 Share Posted March 13, 2012 echo "<td width=\"300\" valign=\"top\"><input type=\"text\" name=\"usr\" value=\"".$name."\" onfocus=\"if(!this._haschanged){this.value=''};this._haschanged=true;\" tabindex=\"1\"></td>"; Quote Link to comment https://forums.phpfreaks.com/topic/258848-php-echo-within-a-print/#findComment-1326959 Share on other sites More sharing options...
Vel Posted March 13, 2012 Share Posted March 13, 2012 echo "<td width=\"300\" valign=\"top\"><input type=\"text\" name=\"usr\" value=\"".$name."\" onfocus=\"if(!this._haschanged){this.value=''};this._haschanged=true;\" tabindex=\"1\"></td>"; Don't even need to use ".$name.", can just put $name straight in there. Quote Link to comment https://forums.phpfreaks.com/topic/258848-php-echo-within-a-print/#findComment-1327026 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.