473,937 Members | 10,511 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4325
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!&qu ot;"
size="35" maxlength="35">

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 20 '05 #4
In article <10************ *@corp.supernew s.com>,
Brian <us*****@juliet remblay.com.inv alid> 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*******@xs4a ll.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******@librar y.lspace.org

Jul 20 '05 #7

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

Similar topics

1
27761
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; - builds XML document around it,
17
3519
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 unsuccessful. Is there a well-respected (by the c.l.c crowd) book or tutorial that really covers scanf in detail?
48
2285
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 for input a string in an array of char that's dynamically allocated. I mean, I wish not to see any such things as char mystring; I don't want to see any number (if possible) I just want to declare something like char *mystring; and then I don't...
9
2088
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 pointer types for the data. I've run into a warning with the following code: void hash_remove( hash_table_t *h, const void *key, const void **old_key,
2
1926
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 has a list of notes related to the Account-Master record (a relationship has been established based on the field CompanyID which exists in both tables).
9
3430
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
1898
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: It is five past seven. It is eleven to ten. It is half past nine. It is a quarter past eight. It is a quarter to ten.
1
1756
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 dl,al ;Copy register al to register dl
1
1625
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 { public class Program
0
9960
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11507
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11087
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9849
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7377
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6072
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4441
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.