php - Why echo's output needs to be separately put in quotes for placeholder's string in input field? -
i generating string placeholder dynamically via php echo function & if don't put quotes around php tags output takes first word of string. why so?
placeholder=<?php echo "hello world"?>
outputs hello in input fieldplaceholder="<?php echo "hello world"?>"
(note quotes around php tags)
outputs hello world in input field.
same happens value attribute of input field.
this due how placeholder
attribute constructed.
you should conform standard of putting value in between quotation marks (see this example proof).
it requires values put in between quotations if wish add spaces value.
so imagine when this:
<input type="text" placeholder=<?php echo "hello world"?> >
you returning in html file:
<input type="text" placeholder=hello world >
it reads 'hello' it's value , html sees 'world' attribute. why need put value in between quotes signify entire string apart of placeholder
attribute.
Comments
Post a Comment