473,606 Members | 2,381 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

redisplaying apostraphes and double quotes...


I've solved this problem once before but for the life of me these past
couple of hours have got me nowhere... I hope someone can help...

I have one form split in two... so the user can switch back and forth, the
values of form B are hidden in form A, and the values of form A are hidden
in B using

<input type=hidden name=variable value='the variables value'>

I have found things work fine until I include an apostraphe - anything after
the apostraphe gets ignored...

I know why the problem occurs, and I know that I should/could use addslashes
and stripslashes to solve... but I've tried and I guess I'm not doing it
right...

When I enter

one two 'three' four

I only get

one two
This is what I have done... On form A I have

$mydata['mytext']=addslashes($_P OST['mytext']);

and when its submitted, form B has it

<input type=hidden name=mytext value='one two \'three\' four'>

when I go back to form A and attempt to redisplay mytext this is what the
html looks like

<textarea name="article" cols="45" rows="10">one two \\</textarea>
Can someone tell me where I am going wrong?

thanx
Jul 16 '05 #1
2 2750
uws
I <EL************ ***********@new s2.calgary.shaw .ca>, Randell D. skrev:
<input type=hidden name=mytext value='one two \'three\' four'>
[sni[
Can someone tell me where I am going wrong?


First of all, fix your HTML. It's totally invalid. It should look like this:

<input type="hidden" name="mytext" value="your value">

You can produce the above code by using code similar to:

<?php echo '<input type="hidden" name="mytext" value="' . htmlentities('y our value') . '">'; ?>

Hope this helps.

mvrgr, Wouter (Read about escaping characters in The Fine Manual!)

--
:wq mail uw*@xs4all.nl

it's the last day on earth :: we'll never say goodbye -- marilyn manson
Jul 16 '05 #2

"uws" <uw*@xs4all.inv alid> wrote in message
news:im******** *************** *******@uwsworl d.xs4all.nl...
I <EL************ ***********@new s2.calgary.shaw .ca>, Randell D. skrev:
<input type=hidden name=mytext value='one two \'three\' four'>
[sni[
Can someone tell me where I am going wrong?
First of all, fix your HTML. It's totally invalid. It should look like

this:
<input type="hidden" name="mytext" value="your value">

You can produce the above code by using code similar to:

<?php echo '<input type="hidden" name="mytext" value="' . htmlentities('y our value') . '">'; ?>
Hope this helps.

mvrgr, Wouter (Read about escaping characters in The Fine Manual!)

--
:wq mail uw*@xs4all.nl
it's the last day on earth :: we'll never say goodbye -- marilyn

manson
Thanx... got it... I had done it once before but I think I'm just over
tired as I had problems concentrating earlier...

cheers,
randell d.
Jul 16 '05 #3

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

Similar topics

5
8257
by: sinister | last post by:
The examples in the online manual all seem to use double quotes, e.g. at http://us3.php.net/preg_replace Why? (The behavior is different with single quotes, and presumably simpler to understand.)
11
36090
by: Jakanapes | last post by:
Hi all, I'm looking for a way to scan a block of text and replace all the double quotes (") with single quotes ('). I'm using PHP to pull text out of a mySQL table and then feed the text into a javascript function called by onClick. The problem is that the text may contain single or double quotes, which screws up the javascript. I eliminated the single quote problem by running the text through addslashes, but the double quotes are a...
5
11441
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. Queston: How do you handle a string that contains both single & double quotes (i.e. 12'X7") Here's the function:
24
22589
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double quotes? Do I need to use code to scrub each string and remove or escape the double quotes before using it in a query? The error I get is this: Error Number 3075: Syntax error (missing operator) in query expression '"credit card billed by...
4
13333
by: (PeteCresswell) | last post by:
Is his just a flat-out "No-No" or is there some workaround when it comes time for SQL searches and DAO.FindFirsts against fields containing same? I can see maybe wrapping the value searched for in single quotes to deal with embedded double quotes, but if there are both embedded single AND double quotes, I can't see any way to deal with it. So, am I doing the right thing to remove all embedded double quotes from my data and write...
8
3381
by: Ahmad A. Rahman | last post by:
Hi all, I have a problem constructing a regular expression using .net. I have a string, separated with comma, and I want to group the string together but, I failed to group a numeric character with decimal values. Example string : 1, 2.3, "two"," three" So, I want to group this string into 4 groups (1), (2.3), (two) and (three)
7
20921
by: gar | last post by:
Hi, I need to replace all the double quotes (") in a textbox with single quotes ('). I used this code text= Replace(text, """", "'" This works fine (for normal double quotes).The problem comes in when you copy a double quote from MS Word and paste it in the text box. What happens is the double quote becomes slanted (“) so my code above can't filter it. I tried to do this text= Replace(text, "““","'")
16
5859
by: Charles Law | last post by:
I have a string similar to the following: " MyString 40 "Hello world" all " It contains white space that may be spaces or tabs, or a combination, and I want to produce an array with the following elements arr(0) = "MyString" arr(1) = 40 arr(2) = "Hello world"
3
1970
by: Balaskas Evaggelos | last post by:
Hi to all, I am developing a php web browser application. But i have a problem. I am listing with opendir but there are a lot of files with quotes in their names. example: News Letter for "ebal" today.html
4
7445
by: Justin Fancy | last post by:
Hi everyone, I need to replace all instances of a double quote(") with two single quotes('') in a text file. I already have some replacements of strings going on, but I tried this one, but the syntax is being read wrong. Here is the code: lineFile1 = sr.ReadLine
0
8440
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
8431
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
8096
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
8306
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...
1
5966
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
3980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2448
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
1
1557
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1300
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.