当前位置: 动力学知识库 > 问答 > 编程问答 >

Submit Button Value does not show full string when there is a space in the string and PHP is used create the button's value

问题描述:

When I use php to create a button's value and the value is a two word string, only the first word is displayed on the button.

Both of the below buttons should show "Compare All" but instead the first one only displays "Compare" on the button.

(Note: I do need to use php for this conditional button value. this is just a simplified version of more complex code for clarity.)

<?php

$ButtonDisp = 'Compare All'; //The two words that should appear on first button

?>

<input name="comp_homes" type="submit" value=<?php echo $ButtonDisp ; ?> // only the first word appear>

<br />

<input name="comp_homes" type="submit" value="Compare All"> <!--This works/shows two words-->

网友答案:

You're missing quotation marks around the value:

<input name="comp_homes" type="submit" value="<?php echo $ButtonDisp ; ?>">
网友答案:

Because you didn't quote it:

<input name="comp_homes" type="submit" value="<?php echo $ButtonDisp ; ?>" />
分享给朋友:
您可能感兴趣的文章:
随机阅读: