473,788 Members | 2,719 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

apostrophe madness

Hello everyone.

I am TOTALLY baffled. PLEASE, I need some help here.

In the event that one must deal with a name including an apostrophe...I am
looking for an appropriate solution.

The flow of data is that the name is entered in via a form text box, stored
in a MySQL table and then read back into another form or echoed out as
needed.

The problem that I am trying to overcome is what happens when an apostrophe
is used in a name, i.e. D'linda.

When I pull the information from the table and try to insert into a text box
on a form, I only get D. No 'linda.

I have tried escaping it, i.e. D\'linda and tried all the variations of ',"
and '".???."' that I can think of. The challenge is placing the name in
this text box:
<input type=text name=addr size=30 maxlength=30 value='".$row[addr]."'>
In the above code, D'linda is stored in $row[addr].

ALL input is most certainly appreciated!
- Steven
Jul 16 '05 #1
6 8952
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Sun, 29 Jun 2003 16:57:52 -0700, "S.
Rhodes" <st***********@ consultant.com> amazingly managed to produce
the following with their Etch-A-Sketch:
Hello everyone.

I am TOTALLY baffled. PLEASE, I need some help here.

In the event that one must deal with a name including an
apostrophe...I am looking for an appropriate solution.

The flow of data is that the name is entered in via a form text
box, stored in a MySQL table and then read back into another form
or echoed out as needed.

The problem that I am trying to overcome is what happens when an
apostrophe is used in a name, i.e. D'linda.

When I pull the information from the table and try to insert into a
text box on a form, I only get D. No 'linda.

I have tried escaping it, i.e. D\'linda and tried all the
variations of '," and '".???."' that I can think of. The challenge
is placing the name in this text box:
<input type=text name=addr size=30 maxlength=30
value='".$row[addr]."'> In the above code, D'linda is stored in
$row[addr].

ALL input is most certainly appreciated!
- Steven

$string = stripslashes($s tring);

HTH.

Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPv+G5Wfqtj2 51CDhEQKKRwCeOf ClskuNwBvWcmzGC dpIF1gohAwAoKS5
2TflUjWihln7fTS m8dQHVr85
=9oC8
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.ne t | forum.digiserv. net
Programming, Web design, development & hosting.
Jul 16 '05 #2
Message-ID: <vf************ @corp.supernews .com> from S. Rhodes contained
the following:
I have tried escaping it, i.e. D\'linda and tried all the variations of ',"
and '".???."' that I can think of. The challenge is placing the name in
this text box:
<input type=text name=addr size=30 maxlength=30 value='".$row[addr]."'>
In the above code, D'linda is stored in $row[addr].

ALL input is most certainly appreciated!


Have you got magic quotes turned on? I don't get this problem with my test
database and it's pretty bog standard tutorial stuff.
http://www.ckdog.co.uk/php/sqltest8.php

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 16 '05 #3
S. Rhodes wrote:
<input type=text name=addr size=30 maxlength=30 value='".$row[addr]."'>
In the above code, D'linda is stored in $row[addr].


Use <input type=text name=addr size=30 maxlength=30
value=\"".htmls pecialchars($ro w[addr])."\">

--
James Sleeman
Gogo:Code http://www.gogo.co.nz/
Email domain : gogo.co.nz see user in from header!
Jul 16 '05 #4
On Mon, 30 Jun 2003 18:20:18 +1200, James Sleeman
<ja***@seeMessa geForDomain.moc > scrawled:
S. Rhodes wrote:
<input type=text name=addr size=30 maxlength=30 value='".$row[addr]."'>
In the above code, D'linda is stored in $row[addr].


Use <input type=text name=addr size=30 maxlength=30
value=\"".html specialchars($r ow[addr])."\">


Use PHP as it's supposed to, and don't just "print" everything...
then you can produce good HTML....

?>
<input type="text" name="addr" size="30" maxlength="30"
value="<?= htmlspecialchar s( $row["addr"] )?>" />
<?
Jul 16 '05 #5
Thank you one and all for your suggestions! I appreciate your input.

Due to Magic Quotes (runtime level) being turn off on the Server that host's
my page, I am not able to benefit from that feature as I do not know of a
way to turn them on from a PHP script.

After reading all of the responses and trying all that was offered, I ended
up with the following:

echo "<td><input type=text name=paddr1 size=30 maxlength=30
value=\"".htmls pecialchars($ro w[paddr1])."\"></td></tr>";

This is doing the job, as far as populating the box appropriately.

Again, THANK YOU one and all!

- Steven
Jul 16 '05 #6
Hello,

remember a few points . it is not xhtml compliant to write html code
that doesnt include "" in it.. <img cellpadding="0" /> is valid xhtml
as <img cellpadding=0 /> is not.

in php print will interp. anything between " " looking for $variables
echo does not. this is slower than using echo and concatinating.

yeah its neat to break up your <? php open and closing tags.. but
sometimes this gets annoying. so my suggestion is something like this:

echo '<input type="text" name="addr" size="30" maxlength="30"
value="'.$row['addr'].'" />';

and please for the love of god its $row['addr'] not $row[addr]

i hope this was helpful :)

- Jonathan P Dryhurst Roberts

ne*******@black-panther.freeser ve.co.uk (James) wrote in message news:<3e******* *********@news. freeserve.com>. ..
On Mon, 30 Jun 2003 18:20:18 +1200, James Sleeman
<ja***@seeMessa geForDomain.moc > scrawled:
S. Rhodes wrote:
<input type=text name=addr size=30 maxlength=30 value='".$row[addr]."'>
In the above code, D'linda is stored in $row[addr].


Use <input type=text name=addr size=30 maxlength=30
value=\"".html specialchars($r ow[addr])."\">


Use PHP as it's supposed to, and don't just "print" everything...
then you can produce good HTML....

?>
<input type="text" name="addr" size="30" maxlength="30"
value="<?= htmlspecialchar s( $row["addr"] )?>" />
<?

Jul 16 '05 #7

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

Similar topics

2
7984
by: Michael Sterling | last post by:
i'm using delphi 7 and have a query in which i'm trying to find names that have an apostrophe in them, i.e. "o'mally". my problem is that when i write my select statement i can't get the quotes right. i get all types of errors no matter what i try. i get "missing right quote", "invalid token" etc. i've tried using QuotedStr and nothing works. here is my current attempt in which i get an "invalid use of keyword. token: n'%'" sSQL :=...
13
11440
by: Richard Hollenbeck | last post by:
To prevent future apostrophe bugs and errors, isn't it just simpler to forbid an apostrophe from being entered into a text field? For example, couldn't "Alice's Restaurant" be changed to "Alices Restaurant" etc. automatically and programmatically during data entry? This would eliminate my concatinated strings from producing errors when I base the string on a query. Think this is an example of the "Dreaded Apostrophe Bug." If I enter a...
1
5376
by: congngo | last post by:
Hi all Every time I export a table into an excel spreadsheet. It has a leading apostrophe on every cells. This drive me nut. I have to do a work around by export table into a txt file than import in excel to get rid of the apostrophe. It has been happen about two months now before it didn't do that. It is only happen when I have text data type in the table. If I change to number data type then the problem go away but most of my...
1
300
by: spacehopper_man | last post by:
hi - I am having "apostrophe in sql" problems ;) I am executing a stored procedure on SQL Server - and passing in a string parameter. the string has a single apostrophe in it. the call is failing with an "Incorrect syntax" message.
1
4028
by: Rose | last post by:
Hi all, I'm trying to create a clickable link, but the pesky apostrophe is preventing the link from getting displayed properly. I'm displaying the contents of a folder (with contains the apostrophe), with the filename as a clickable link. The files show up properly, but the link location cuts off at the apostrophe. Here's a code snippet (fi is an instance of FileInfo):
2
12338
by: Tom | last post by:
Hi, I have some kind of problems with an apostrophe character ('). I would like to select from DataTable DataRow containing value horses' (with an apostrophe on the end). But when I do it in an obvious way, like this: DataTable dt = new DataTable(); DataColumn id = new DataColumn("ID", Type.GetType("System.Int32"));
1
2520
by: Kayvine | last post by:
Hi guys, this is a question I have for an assignment, it is pretty long, but I am not asking for the code(well if someone wants to write I'll be really happy, lol), but I just want to know how to start it and what main topics in C I will need to cover in the assignment. Thanks a lot. CSC180 Assignment #3: Menu Madness Due Date: Thursday, November 8th at 1:00am Contents: · General Info · What to Hand In o Submission Instructions
9
3599
by: Thomas 'PointedEars' Lahn | last post by:
Jukka K. Korpela wrote: IBTD. For example, in English it is customary (and AIUI expected) to use the character that ’ represents should be used to delimit a quotation within direct speech (which itself should be delimited by “ and ”. (I gathered that from reading several English books.) I think you would agree that it would make especially English text with quotations in direct speech (say, in a novel where one person tells another...
4
2277
by: Razzbar | last post by:
I'm working on a bookmarklet that grabs information from a page and submits it to a server. Yet another social bookmarking application. I'm having trouble with page titles that include an apostrophe. I'm using encodeURIComponent() around the page title, and again around the URL. Apparently the browser is inserting a backslash before any apostrophe. I can see that when I write the $_GET data to a file in PHP on the server. When the GET...
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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
10373
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
10177
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...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
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
6750
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
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.