Re: forms value and php echo stops after first space



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

.



Relevant Pages

  • Re: Difference between and : symbols
    ... lisp> ... You can inhibit evaluation with the special operator QUOTE. ... The specific thing that confused you is why ASDF functions ... But what ASDF really wants is a string. ...
    (comp.lang.lisp)
  • RE: Internet UTC
    ... Local lcQuote As String,; ... *-- Grab the quote from the Web page. ... *-- trailing HTML with the TRANSFORMAND VALfunctions. ...
    (microsoft.public.fox.programmer.exchange)
  • Re: fastest way to change case of string
    ... string rather than concatenating a new string is indeed much faster. ... Dim quoted As Collection ... Const QUOTE = "'" ... ChangeCaseX = StrConv ...
    (microsoft.public.vb.general.discussion)
  • MD5 Hash with single quote = grief in dao.findfirst
    ... I know when you need to create a query string and the data contains a single ... quote, you must double the quote as an escape sequence. ... Hundreds of assumption cells combined into one 16 character Hash. ... I build the criteria SQL string. ...
    (microsoft.public.access.modulesdaovba)
  • RE: VBA, and SaveAs Function
    ... The type mismatch comes about in the Str functions in your SaveAs line; ... you're passing a string to a function that expects a number. ... > I have been creating a quote module for the project managers at my lab, ... > save to a unique file, and I am up against a wall. ...
    (microsoft.public.excel.programming)