I have a code that you can see below. The problem is that the $desktop and $mobile has in them ' and ", which creates a problem when they are put together in $content. I need to create a piece of code that will make the $desktop and $mobile inserted without any problems when in content.
Right now, when there is ' , it thinks that's the end of the string and goes to mobile. it has to insert all of it. So some kind of trick that will protect ' and " within those two, but still insert them as they are shown.
Here is an example of the $desktop
<div class="bpb-p11m-body">
<div class="bpb-p11m-top">Breaking Performance Barriers</div>
<div class="bpb-p11m-image"></div>
<div class="bpb-p11m-body-text">
<div class="bpb-p11m-text">A real man was the provider and protector. A real man was ‘”the man.” He was adding value.</div>
<div class="bpb-p11m-text">That was my attitude, and it seemed to pay off. Every summer of my youth, I worked hard on my aunt and uncle’s ranch: buckin’ hay bales, driving truck, building fence.</div>
<div class="bpb-p11m-text">I loved hard work. Besides, it kept me in shape for sports. Hard work and athletic accomplishment were
signs of manhood—coming of age. I was adding value. </div>
<div class="bpb-p11m-text">Championship trophies and business accomplishments measured our worth—taught us discipline and goal orientation. I was tough. Ambitious. My life was laid out before me, clear and straight. I was adding value.</div>
</div>
</div>
The entire code:
$pageid = $_GET['pageid']; //page id
$css = get_post_meta($pageid,'fsmg_css_root',true); // getting url for css
$desktop = get_post_meta($pageid,'ecpt_enterhtmlcode_desktop',true); // code for desktop
$mobile = get_post_meta($pageid,'ecpt_enterhtmlcode_mobile',true); //code for mobile
$content = '[desktop]<div style="position:absolute; top:0; left:0; width:100%; height:100%; background-color:#fff;">'.$dektop.'</div>[/desktop][mobile]<div style="position:aboslute; top:0; left:0; width:100%; height:100%;">'.$mobile.'</div>[/mobile]'; //final code for page editor
?>
<!-- some info while they are waiting -->
<h1 style="margin-top:50px; text-align:center;">Magazine preview is being generated. Please wait....</h1>
<center><img src="[login to view URL]" style="margin:auto; width:50px;"></center>
<!-- Form submits the data -->
<form style="display:none;" action="[login to view URL]" method="post">
<input type="hidden" name="content" value='<?php echo $content; ?>' />
<input type="hidden" name="css_url" value="<?php echo $css; ?>" />
<input type="submit" class="submit" value="Submit" />
</form>
<script src="//[login to view URL]"></script>
<script>
//auto submit of form
setTimeout(function() {
jQuery('.submit').trigger('click');
},300);
</script>