php from database into text input field—what's wrong?
Posted: Sun Dec 21, 2014 9:37 pm
I have the following code to pull data from mysql:
which is fine until I use quotes, such as:
I tried escaping it with addslashes, but it still breaks the page that the data is displayed on. (It's displayed in an admin page within Wordpress, but it works fine where the data is used on the front end.) This is the code output in the admin page:
Which looks like this:

How can I fix this?
Code: Select all
<input type="text" name="title" value="<?php echo addslashes get_option('title'); ?>" />Code: Select all
This <span class="bannertitle">Title</span>Code: Select all
<input type="text" name="title" value="This<span class="bannertitle">Title</span>" />
How can I fix this?