Apostrophe in html textfield
Posted: Sat Feb 06, 2010 11:36 am
I'm sure this is old news, but I've spent hours on the web looking for a solution to no avail. I have a site driven by mysql. One of the tables is called 'clients'. Many of these clients have apostrophes in their names. On an admin page that I've created within the site I have a form that dynamically calls in the client name to a textfield for editing. Everything after the apostrophe drops off.
I'm adding to the database using addslashes (and have also tried htmlspecialchars) and stripping slashes for display. If I echo the results outside of the textfield, they're fine. It's just when I try to show them IN the textfield all goes awry.
I'm using:
Any assistance would be greatly appreciated.
I'm adding to the database using addslashes (and have also tried htmlspecialchars) and stripping slashes for display. If I echo the results outside of the textfield, they're fine. It's just when I try to show them IN the textfield all goes awry.
I'm using:
Code: Select all
<?php echo "<input name='name' type='text' size='37' value='".stripslashes($row['name'])."'/>"; ?>