Hello i’m currently using a table to input values into a custom meta field. I have a text box called episode title. My problem here is that if the characters ‘ ” are added in the field then everything goes in to chaos. I want to use the htmlspecialchars to input the values as " and ' instead of ‘ “. the below code does not work to covert the characters. Can anyone please help?
<p>
<input type="text" name="episode_title[]" id="episode_title[]" value="<?php echo ($_POST['episode_title']); ?>" class="title regular-text" style="width: 98%" />
<span class="description"><?php _e('Title of The Episode.'); ?></span>
</p>
add this to the
htmlspecialchars
call:ENT_QUOTES
like so:This will enable changing of both the
"
and the'
quotes$_POST['episode_title']
is an array, so you need to get the right value from the array and usehtmlspecialchars()
on that value.Something like:
Edit: I am assuming that the
$_POST
array contains the results of the form when it is submitted.