Re: forms value and php echo stops after first space
- From: "John Dunlop" <usenet+2004@xxxxxxxxxxxxxxxx>
- Date: 25 Mar 2006 04:27:43 -0800
Somebody:
[$myvar='TEST 123';]
<input name="testbox1" type="text" value=<?php echo "$myvar"; ?>>
the result is a form with a textbox with the default value "TEST"
You are obviously aware that the value must be within quotes in the
HTML, but if you look at the HTML source you'll see the value is not
quoted, which causes the value to be cut off after 'TEST'. PHP
interprets what's after echo here as a string delimited by double quote
marks, that string being the variable $myvar, and only the value of
that string, not the quote marks as well, is echo-ed.
Two options. Either include the quotes in the echo-ed string (there
are various ways) or include them directly in the markup. Given the
advice to always quote attribute values, the latter seems more
appropriate.
--
Jock
.
- Follow-Ups:
- Re: forms value and php echo stops after first space
- From: edvard
- Re: forms value and php echo stops after first space
- References:
- forms value and php echo stops after first space
- From: edvard
- forms value and php echo stops after first space
- Prev by Date: Re: onclick won't open new window until after refresh
- Next by Date: Re: How to retrieve the text of a drop down list after a POST?
- Previous by thread: Re: forms value and php echo stops after first space
- Next by thread: Re: forms value and php echo stops after first space
- Index(es):
Relevant Pages
|