How do I display ' and " inside input tags? 
Author Message
 How do I display ' and " inside input tags?

Folks,

I have a simple PHP database that I use to record and later re-display
articles for a small publication.  Sometimes the headlines contain single
*and* double quotes... This is not a problem for me to display them in an
html output, but I have the option to re-edit the articles, meaning the
original form with original values is written back in... The problem is
though, I'm unsure as to how I can permit single and double quotes from
appearing inside a form text box, using something like the following, as an
example...

<input type=text name=headline size=30 maxlength=30 value=""They're not
there" he says">

I have considered using a backslash, but the backslash appears in the value
so if my idea is right, perhaps I''m implementing it wrong...

anybody got any ideas?

thanks
randelld



Sun, 31 Jul 2005 06:58:13 GMT  
 How do I display ' and " inside input tags?
E.g.

" => &#34;
" => &quot;
' => &#39;


Quote:

> Folks,

> I have a simple PHP database that I use to record and later re-display
> articles for a small publication.  Sometimes the headlines contain single
> *and* double quotes... This is not a problem for me to display them in an
> html output, but I have the option to re-edit the articles, meaning the
> original form with original values is written back in... The problem is
> though, I'm unsure as to how I can permit single and double quotes from
> appearing inside a form text box, using something like the following, as
an
> example...

> <input type=text name=headline size=30 maxlength=30 value=""They're not
> there" he says">

> I have considered using a backslash, but the backslash appears in the
value
> so if my idea is right, perhaps I''m implementing it wrong...

> anybody got any ideas?

> thanks
> randelld



Sun, 31 Jul 2005 07:04:02 GMT  
 How do I display ' and " inside input tags?
E.g.

<input type="text"
  name="headline"
  value="&#34;They&#39;re not there&#34; he says">

Take a look at http://www.php.net/manual/en/function.html-entity-decode.php


Quote:
> E.g.

> " => &#34;
> " => &quot;
> ' => &#39;



> > Folks,

> > I have a simple PHP database that I use to record and later re-display
> > articles for a small publication.  Sometimes the headlines contain
single
> > *and* double quotes... This is not a problem for me to display them in
an
> > html output, but I have the option to re-edit the articles, meaning the
> > original form with original values is written back in... The problem is
> > though, I'm unsure as to how I can permit single and double quotes from
> > appearing inside a form text box, using something like the following, as
> an
> > example...

> > <input type=text name=headline size=30 maxlength=30 value=""They're not
> > there" he says">

> > I have considered using a backslash, but the backslash appears in the
> value
> > so if my idea is right, perhaps I''m implementing it wrong...

> > anybody got any ideas?

> > thanks
> > randelld



Sun, 31 Jul 2005 07:11:00 GMT  
 How do I display ' and " inside input tags?
[Escaping PHP output]

Quote:

><input type=text name=headline size=30 maxlength=30 value=""They're not
> there" he says">

> I have considered using a backslash, but the backslash appears in the value
> so if my idea is right, perhaps I''m implementing it wrong...

You can use entities (e.g. &quot; for ") or character references (e.g.
&#34; for " and &#39; for ') to escape quotes in attribute values.


Sun, 31 Jul 2005 07:20:47 GMT  
 How do I display ' and " inside input tags?

Quote:

> You can use entities (e.g. &quot; for ") or character references (e.g.
> &#34; for " and &#39; for ') to escape quotes in attribute values.

Yes, but the apostrophe need not be "escaped" when the attribute is enclosed
into quotation marks.

On the other hand, the question arises what _else_ gets written into the
attributes. If the data comes from database entries containing headlines,
there's really nothing to stop _any_ characters*) from getting into the
attribute values, unless some filtering is specifically programmed. I'm
pretty sure there's some general-purpose _function_ in PHP to handle such
issues.

*) such as the string &copy, which will be treated as copyright symbol by
browsers, or non-Ascii with potentially confusing effects.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html



Sun, 31 Jul 2005 08:03:37 GMT  
 How do I display ' and " inside input tags?


Quote:

> Folks,

> I have a simple PHP database that I use to record and later re-display
> articles for a small publication.  Sometimes the headlines contain single
> *and* double quotes... This is not a problem for me to display them in an
> html output, but I have the option to re-edit the articles, meaning the
> original form with original values is written back in... The problem is
> though, I'm unsure as to how I can permit single and double quotes from
> appearing inside a form text box, using something like the following, as
an
> example...

> <input type=text name=headline size=30 maxlength=30 value=""They're not
> there" he says">

> I have considered using a backslash, but the backslash appears in the
value
> so if my idea is right, perhaps I''m implementing it wrong...

> anybody got any ideas?

> thanks
> randelld

Many thanks... I had been incorrectly playing around with urlencode and
urldecode but now see why I was wrong...

thanks for pointing me in the right direction...



Sun, 31 Jul 2005 08:20:55 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. The tag, the whole tag, nothing but the tag, s'help me

2. Boolean controls don't respond to input when inside an event in the event structure

3. Tags.Internal_Tag(String'Input(Stream)) ??

4. Keeping cursor inside tagged area

5. how to get a tag name from inside a bind script

6. Printing "DAS Tagged" Records problem

7. "" tag is removed

8. Scheme "tags" info WANTED

9. "High School Computing: The Inside Story"

10. MPF -"Inside the CLR" video

11. '"""' and linefeed characters

12. "Tagged Types"

 

 
Powered by phpBB® Forum Software