I am trying to keep a default text in a text box. But if I try to use couple of words having spase in between it just only taking the first word. I want to show the couple of words in the text box. How can I do that?
Here is my code...... I am passing the sentence through $Name
$Name = "Hello World";
But it's unly showing "Hello" in the text box.
<input type="text" name="Domain_Name[]" value = <?php print "$Name";?> size = "30">
Problem with Default value in text box using PHP
Moderator: General Moderators
Re: Problem with Default value in text box using PHP
[Mod's please move to -Normal]
(I like echo better than print, but there is really no difference....) However either print or echo do not add quotes around the string, unless you manually add them. I added them to the raw HTML. If you wanted to add them to the string, you would do
<?php echo ""$Name"";?>
The " tells PHP to actually print a quote, not to end the current string.
You are missing the quotes around the value tryszms wrote:I am trying to keep a default text in a text box. But if I try to use couple of words having spase in between it just only taking the first word. I want to show the couple of words in the text box. How can I do that?
Here is my code...... I am passing the sentence through $Name
$Name = "Hello World";
But it's unly showing "Hello" in the text box.
<input type="text" name="Domain_Name[]" value = <?php print "$Name";?> size = "30">
Code: Select all
<input type="text" name="Domain_nameї]" value = "<?php echo "$Name";?>" size ="30"><?php echo ""$Name"";?>
The " tells PHP to actually print a quote, not to end the current string.