Youtube Embed Code Stored In Database Not Appearing In Html Form
I have an UPDATE php page to edit a websites database that contains Youtube's embed code which then gets properly displayed when the table is called. On the update page im calling
Solution 1:
You have to use htmlentities to convert the quotes to HTML entities.
$str = htmlentities($str);
http://php.net/manual/en/function.htmlentities.php
Use it like this:
<formmethod="post">
Submitter: <inputtype="text"name="submitter"value="<?=$video['submitter'] ?>" /><br />
Video Title: <inputtype="text"name="videoTitle"value="<?=$video['videoTitle'] ?>" /><br />
Channel Name: <inputtype="text"name="channelName"value="<?=$video['channelName'] ?>" /><br />
Video Link: <inputtype="text"name="videoLink"value="<?= htmlentities($video['videoLink']) ?>" /><br /><inputtype="hidden"name="videoId"value="<?=$video['videoId'] ?>" /><inputtype="submit"value="Save"name="save" /></form>
Also if you are going to be saving this data into a database be sure to call html_entity_decode on the data being sent by the form before saving it to the database.
Post a Comment for "Youtube Embed Code Stored In Database Not Appearing In Html Form"