Jump to content

[SOLVED] Spaces in variable names


cliftonbazaar

Recommended Posts

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

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>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.