473,382 Members | 1,442 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,382 software developers and data experts.

Proper code for input tag

Hello All,

I have an input tag that I am populating with data from a database.
My problem is the following:

The data in the database that contains single and double quotes.

What do I do?

Currently, I've tried the following...
input type=text name=collName value='Be'er Shmuel Talmudical Academy'
size=35 maxlength=35

But the above code only displays "Be"

I've tried...

input type=text name=collName value="Be'er Shmuel Talmudical Academy"
size=35 maxlength=35

But that works okay for single quotes, but for double quotes I have
the same problem...

How do I fix this? Should I just stick with double quotes and then is
it possible to escape the double quotes that are in the field?

Thanks!
--
Nathan
Jul 20 '05 #1
6 4302
On 26 Jul 2004 19:09:39 -0700, Nathan Given <ng****@hotmail.com> wrote:
Hello All,

I have an input tag that I am populating with data from a database.
My problem is the following:

The data in the database that contains single and double quotes.

What do I do?

Currently, I've tried the following...
input type=text name=collName value='Be'er Shmuel Talmudical Academy'
size=35 maxlength=35

But the above code only displays "Be"

I've tried...

input type=text name=collName value="Be'er Shmuel Talmudical Academy"
size=35 maxlength=35

But that works okay for single quotes, but for double quotes I have
the same problem...

How do I fix this? Should I just stick with double quotes and then is
it possible to escape the double quotes that are in the field?

Thanks!
--
Nathan


Replace ' with ' and " with ", and escape the & instead when
processing the data. A little simpler exercise than escaping all the
characters you can't use in a script.
Jul 20 '05 #2
Nathan Given wrote:
I have an input tag that I am populating with data from a database.
My problem is the following:

The data in the database that contains single and double quotes.

input type=text name=collName value='Be'er Shmuel Talmudical
Academy' size=35 maxlength=35

But the above code only displays "Be"

How do I fix this? Should I just stick with double quotes and then
is it possible to escape the double quotes that are in the field?


Depends on the scripting language and your database. It is probably
possible. You'd get more useful help by asking how to do this in a
group dedicated to the particular language you use. If it's PHP,
perhaps this will help:

http://us3.php.net/htmlentities

(aside: why do the php folks insist on several different domains that
hold the same info? I seem to get redirected to a us3 or de subdomain
depending on I don't know what. The phase of the moon?)

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3
Nathan Given wrote:

input type=text name=collName value='Be'er Shmuel Talmudical Academy'
size=35 maxlength=35

But the above code only displays "Be"

Place all the values in double quotes. Convert all double quotes within
the text to "&quot;":

<input type="text" name="collName"
value="Be'er Shmuel Talmudical Academy is &quot;Great!&quot;"
size="35" maxlength="35">

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 20 '05 #4
In article <10*************@corp.supernews.com>,
Brian <us*****@julietremblay.com.invalid> wrote:
http://us3.php.net/htmlentities

(aside: why do the php folks insist on several different domains that
hold the same info? I seem to get redirected to a us3 or de subdomain
depending on I don't know what. The phase of the moon?)


Load balancing server maybe?

--
Kris
<kr*******@xs4all.netherlands> (nl)
Jul 20 '05 #5
Kris wrote:
Brian wrote:

why do the php folks insist on several different domains that
hold the same info? I seem to get redirected to a us3 or de
subdomain depending on I don't know what.


Load balancing server maybe?


You certainly don't need multiple urls to accomplish that!

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #6
In <f7**************************@posting.google.com >, on 07/26/2004
at 07:09 PM, ng****@hotmail.com (Nathan Given) said:
How do I fix this?


Use charater entities for such situations, e.g.,

'
&acute;
&dquote;

input type=text name=collName value='Be'er Shmuel Talmudical
Academy' size=35 maxlength=35

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to sp******@library.lspace.org

Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vlajko Knezic | last post by:
Not so sure what is going on here but is something to do with the way UTF8 is handled in Perl and/or LibXML The sctript below: - accepts a value from a form text field; - ...
17
by: Lefty Bigfoot | last post by:
Hello, I am aware that a lot of people are wary of using scanf, because doing it improperly can be dangerous. I have tried to find a good tutorial on all the ins and outs of scanf() but been...
48
by: Michel Rouzic | last post by:
I know it must sound like a newbie question, but I never really had to bother with that before, and I didn't even find an answer in the c.l.c FAQ I'd like to know what's the really proper way...
9
by: liljencrantz | last post by:
Hi, I have a piece of code that uses hashtables to store pointers to various bits of data. The hashtable sees all pointers as const void *, while the application obviously uses various other...
2
by: Swinky | last post by:
Can someone explain to me the proper syntax for requery and where to input it in my form? I have a main form "Account-Master" with two subforms: 1.) Contacts and 2.)TNotes. The TNotes subform...
9
by: uidzer0 | last post by:
Hey everyone, Taken the following code; is there a "proper" or dynamic way to allocate the length of line? #include <stdio.h> #include <errno.h> int main(int argc, char **argv) { FILE *fp;
6
by: mattmao | last post by:
Hi all. There is a challenge question I encountered recently, which says: "In plain English, there are six different ways when you want to tell someone else about the current time: ...
1
by: sukatoa | last post by:
A86 code (Assembly) jmp main main: mov ah,0h ;Service 0, Captures the input and stores it to register al... int 16h ; Interrupt 16 BIOS... mov ah,2h ;Service 2 mov...
1
by: mattmao | last post by:
I am brand new to C#.NET so here is my trial on this lab exercise: using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace lab02exec { ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.