Jump to content

[SOLVED] Spaces in a


cliftonbazaar

Recommended Posts

The following code worked fine ...

 

WHILE($names_show = mysql_fetch_array($character_names)) { //Lets loop through all the records
      echo "<option value=".$names_show['characterName'].">".$names_show['characterName']."</option>";
    }

... until my brother tested my code and made his character have two names -> "El Farto".

What this means is that

print_r($_POST);

produces Array ( [player_view] => El )

AND

$temp = $_POST[player_view];

produces El

 

How and what do I change so the space comes up in the name?

Link to comment
https://forums.phpfreaks.com/topic/163088-solved-spaces-in-a/
Share on other sites

echo "<option value='".$names_show['characterName']."'>".$names_show['characterName']."</option>";

 

You have to use quotes.

 

<option value=El Farto> would treat only El as the value. Farto is not valid xHTML so it's omited.

 

<option value='El Farto'> will treat El Farto as the value.

Link to comment
https://forums.phpfreaks.com/topic/163088-solved-spaces-in-a/#findComment-860490
Share on other sites

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.