By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,285 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,285 IT Pros & Developers. It's quick & easy.

Delimit char for value parm of <input> tag

P: n/a
Don
Using PHP, I'm creating an <input> tag. How do you delimit the text string for the value parm of an
<input> tag, when the string contains the delimit char?

Example: <input...value="This text has a " in it"...>

I tried preceeding the " with a the escape char \, but the browser apparently still used the
embedded " as termination of the value string.

One other thing...is the delimiter limited to just " and ' ?

Thanks for any help.
Don
Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Don
On Sat, 06 Nov 2004 23:49:47 -0700, Don <no@adr.com> wrote:
Using PHP, I'm creating an <input> tag. How do you delimit the text string for the value parm of an
<input> tag, when the string contains the delimit char?

Example: <input...value="This text has a " in it"...>

I tried preceeding the " with a the escape char \, but the browser apparently still used the
embedded " as termination of the value string.

One other thing...is the delimiter limited to just " and ' ?

Thanks for any help.
Don


I just realized I need to tell the rest of the story.

The value for that <input> tag comes from the client, therefore it
might contain any characters, including " and '. And, it might even
contain both of those characters. That's why I'm hoping there is a
way to delimit embedded chars, or a way to use something other than "
and ' for the delimiters.

Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 17 '05 #2

P: n/a
Don wrote:
On Sat, 06 Nov 2004 23:49:47 -0700, Don <no@adr.com> wrote:

Using PHP, I'm creating an <input> tag. How do you delimit the text string for the value parm of an
<input> tag, when the string contains the delimit char?

Example: <input...value="This text has a " in it"...>

I tried preceeding the " with a the escape char \, but the browser apparently still used the
embedded " as termination of the value string.

One other thing...is the delimiter limited to just " and ' ?

Thanks for any help.
Don

I just realized I need to tell the rest of the story.

The value for that <input> tag comes from the client, therefore it
might contain any characters, including " and '. And, it might even
contain both of those characters. That's why I'm hoping there is a
way to delimit embedded chars, or a way to use something other than "
and ' for the delimiters.


From the HTML Specification at W3C:
---
By default, SGML requires that all attribute values be delimited using
either double quotation marks (ASCII decimal 34) or single quotation
marks (ASCII decimal 39). Single quote marks can be included within the
attribute value when the value is delimited by double quote marks, and
vice versa. Authors may also use numeric character references to
represent double quotes (") and single quotes ('). For double
quotes authors can also use the character entity reference &quot;.
---

/Bent
Jul 17 '05 #3

P: n/a
Don
On Sun, 07 Nov 2004 09:17:14 +0100, Bent Stigsen <ng**@thevoid.dk> wrote:
Don wrote:
On Sat, 06 Nov 2004 23:49:47 -0700, Don <no@adr.com> wrote:

Using PHP, I'm creating an <input> tag. How do you delimit the text string for the value parm of an
<input> tag, when the string contains the delimit char?

Example: <input...value="This text has a " in it"...>

I tried preceeding the " with a the escape char \, but the browser apparently still used the
embedded " as termination of the value string.

One other thing...is the delimiter limited to just " and ' ?

Thanks for any help.
Don

I just realized I need to tell the rest of the story.

The value for that <input> tag comes from the client, therefore it
might contain any characters, including " and '. And, it might even
contain both of those characters. That's why I'm hoping there is a
way to delimit embedded chars, or a way to use something other than "
and ' for the delimiters.


From the HTML Specification at W3C:
---
By default, SGML requires that all attribute values be delimited using
either double quotation marks (ASCII decimal 34) or single quotation
marks (ASCII decimal 39). Single quote marks can be included within the
attribute value when the value is delimited by double quote marks, and
vice versa. Authors may also use numeric character references to
represent double quotes (") and single quotes ('). For double
quotes authors can also use the character entity reference &quot;.
---

/Bent


Hey, thanks much Bent. I'll use one of the alternate ways to represent double quotes.

Thanks again,
Don
Jul 17 '05 #4

P: n/a
.oO(Don)
Hey, thanks much Bent. I'll use one of the alternate ways to represent double quotes.


You can use htmlspecialchars() for that.

Micha
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.