[thelist] Double quotes ("), PHP & MySQL

Chris axe at suburbia.com.au
Wed Aug 21 08:32:01 CDT 2002


Hello,

Try using htmlspecialchars($name) to output the data back into the form. It
will convert the quotes to their respective HTML codes ie: " becomes "
and ' becomes &#039.

Regards,
Chris

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Peter Duchateau
Sent: Wednesday, 21 August 2002 22:56
To: Evolt List
Subject: [thelist] Double quotes ("), PHP & MySQL


A have this form I use to insert and update records.

I have an input field
<input type="text" name="fname" value="<?= $name; ?>">

When the user types something with single and double quotes, the insert into
the DB works just fine. Eg. abc"de'fg"

When the user wants to update the record. I fetch the data and then display
the value in the input field, I get this:

<input type="text" name="fname" value="abc"de'fg"">

The browser only displays this value: abc
which is correct because the value is terminated at the second double qoute.

How can I get this to work ?
Replace the double quotes with single quotes in onSubmit when the value is
first inserted ?
Any other solutions ?

--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list