cliftonbazaar Posted April 20, 2009 Share Posted April 20, 2009 When I print a variable that has a space in it I have no problems, but when I display the same variable in a text box it will not display anything after the first space; echo "<INPUT type=text name=adventure_name size=20 value=".$adventure['name']."></TD><TR>"; In this case the $adventure['name'] = 'Goblin Caves'; in the text box it only displays 'goblin' while it 'goblin caves' is displayed on another page with no problems. Link to comment https://forums.phpfreaks.com/topic/154847-solved-spaces-in-variable-names/ Share on other sites More sharing options...
Yesideez Posted April 20, 2009 Share Posted April 20, 2009 You need to surround the code as well... echo '<INPUT type="text" name="adventure_name" size="20" value='.$adventure['name'].'></TD><TR>'; HTML attributes should be passed inside double quotes. Link to comment https://forums.phpfreaks.com/topic/154847-solved-spaces-in-variable-names/#findComment-814394 Share on other sites More sharing options...
jackpf Posted April 20, 2009 Share Posted April 20, 2009 You need to surround the code as well... echo '<INPUT type="text" name="adventure_name" size="20" value='.$adventure['name'].'></TD><TR>'; HTML attributes should be passed inside double quotes. Hey, don't you mean echo '<INPUT type="text" name="adventure_name" size="20" value="'.$adventure['name'].'"></TD><TR>'; Link to comment https://forums.phpfreaks.com/topic/154847-solved-spaces-in-variable-names/#findComment-814418 Share on other sites More sharing options...
cliftonbazaar Posted April 22, 2009 Author Share Posted April 22, 2009 Thanks for the replies, have got it working now Link to comment https://forums.phpfreaks.com/topic/154847-solved-spaces-in-variable-names/#findComment-816240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.