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

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($_POST['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 2736
uws
I <EL***********************@news2.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('your 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.invalid> wrote in message
news:im******************************@uwsworld.xs4 all.nl...
I <EL***********************@news2.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('your 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
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...
11
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...
5
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. ...
24
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...
4
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...
8
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...
7
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...
16
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...
3
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...
4
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...
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: 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: 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...
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
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...
0
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...
0
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...

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.