jblayney
asked on
escaping single quotes in php output.
Hello,
I am generating a google map using advanced custom fields, it works great except that I have a lot of French text and they used single quotes all over the place, the single quotes are breaking my google map output..
I tried wrapping my field ( the_field('street_address' ) ) in esc_html(), esc_html() and esc_attr() with no luck..
I am generating a google map using advanced custom fields, it works great except that I have a lot of French text and they used single quotes all over the place, the single quotes are breaking my google map output..
I tried wrapping my field ( the_field('street_address'
var contentString<?php echo $post->ID; ?> = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h3 id="firstHeading" class="firstHeading"><?php the_title(); ?></h3>'+
'<div id="bodyContent">'+
'<p><b>Address:</b> <br /><?php echo the_field('street_address'); ?>, <?php echo the_field('city'); ?><br /> ' +
'<?php echo the_field('postal_code'); ?><br><br />' +
'<b><a href="<?php echo the_field('website'); ?>" target="_blank">Visit website</a></b><br />' +
'<b><span>Distance: <?php echo get_the_distance(null, 1); ?> KM </span></b><br />' +
'</p>'+
'</div>'+
'</div>';
ASKER
Hello,
Yes I did.. It didn't work. Also this is output to page, not entering into DB
Yes I did.. It didn't work. Also this is output to page, not entering into DB
ASKER
i wondering if it is because it is an ACF (Advanced Custom Fields) field
I frequently meet this problem.
The simplest way I have found is to replace the apostroph by an acute accent
´ ´ ´
The look is almost the same....
Consider changing that in your datafile as well as when processing it thru php
The simplest way I have found is to replace the apostroph by an acute accent
´ ´ ´
The look is almost the same....
Consider changing that in your datafile as well as when processing it thru php
(Just for the fun: my village name has an apostroph. When buying anything online, if I leave the apostroph anything can happen during the data transfers between the different carriers )
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you
https://www.php.net/manual/en/function.addslashes.php