473,387 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Delimit char for value parm of <input> tag

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
4 2448
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
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
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
.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: chirs | last post by:
Hi, I want to put a value in a cookie. The following code does not work. It does not store the box1.value in the cookie. How can I fix it? <input type="text" name="box1"...
2
by: not 2 swift | last post by:
I thought I would update an old page on which I had used a <INPUT TYPE=image ...> with a <BUTTON><IMG SRC=...></BUTTON> The problem is that <BUTTON> always provides a shadow/emboss effect. Can...
3
by: iinet | last post by:
How can i set in my css a min width for input elements, but leave the max size dynamic? Ben
3
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like...
5
by: Bart van Deenen | last post by:
Hi all I have a form with a couple of input fields, embedded within spans. I am using script.aculo.us for dragging and dropping, and want to reorder the input fields that way. The input fields are...
2
by: Mara Guida | last post by:
Hi, After I've populated a page with some <INPUT ...> elements I'd like to have access to whatever is written there. The best I've done (which does not work) is: ================ //...
2
by: Richard Maher | last post by:
Hi, I'm trying to use the Visibility Style attribute for a Div to effectively PopUp a lightweight window with some additional context-sensitive information, when a user mouses over a given...
1
by: JPhilS | last post by:
Hi to all Webmaster! I have discover this problem when I inserted the scores of the students i a centain subject. I am making a school project with regards to saving students' record. first, I...
1
by: test9991014 | last post by:
Hi folks, I've got something like this: <table> <tr> <td>1</td> <td align=center> <input type=text> </td>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.