first all, do not simply give me a link, i did read many docs from google but i can not find answer.
explain first, then links - thanks.
followings are code in a php file but out of <?php?> tag.
===============================================
<?php $var0="hello, boys"; ?>
<form>
<input type="text" value=<?php print("'$var0'"); ?> style="width:200;">
<br>
<input type="text" value=<?php print("$var0"); ?> style="width:200;">
<br>
<input type="text" value=<?php print($var0); ?> style="width:200;">
</form>
<?php print("'$var0'"); ?>
<br>
<?php print("$var0"); ?>
<br>
<?php print($var0); ?>
<br>
===============================================
output:
-------------- first 3 lines (in inputs) are:
hello, boys
hello,
hello,
-------------- last 3 lines (not in inputs) are:
'hello, boys'
hello, boys
hello, boys
if you compare a line (in input) with respective line (not in input), you see they are different.
what does first 3 lines mean?
(last 3 lines are easy to be understood)
why?
by the way: is print() the same as echo()?
could u explain why for these fun lines?
Moderator: General Moderators
-
php12342005
- Forum Commoner
- Posts: 79
- Joined: Mon Mar 21, 2005 3:35 am
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
php12342005 are you doing it on purpose??? Use
Code: Select all
tags please... I'm not doing it for you this time.. every time we ask you you do not seem to be taking it on board - in fact, you argued against it the last time
68 posts - still not listening.- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact:
The HTML you generated is
The first line is the standard way to write tag attribute values using either " or '. The last two are not. Whenever you deprive the value from quotes, HTML will take the first word, in your case, 'hello,' as its valid value. And the rest of the sentence will be ignored.
Now if you are complaining about the quotes not showing up in the textbox, its normal. But if you want so, it must be generated as this...
in php ...
Code: Select all
&lt;form&gt;
&lt;input type="e;text"e; value='hello, boys' style="e;width:200;"e;&gt;&lt;br&gt;
&lt;input type="e;text"e; value=hello, boys style="e;width:200;"e;&gt;&lt;br&gt;
&lt;input type="e;text"e; value=hello, boys style="e;width:200;"e;&gt;
&lt;/form&gt;Now if you are complaining about the quotes not showing up in the textbox, its normal. But if you want so, it must be generated as this...
Code: Select all
value="e;'hello, boys'"e;Code: Select all
value=<?php print("\"'hello, boys'\""); ?>