I have a preview page or an email that is created with html and php. So basically on this page there is a big $body string that can contain any html and php. But I want to send this string to another page with a link:
echo '<a href="[theURL]?body='.htmlentities($body).'">Click here</a>';
the link goes to a second php page that should display everything the same was as on the first page:
<?php
if(isset($_GET["body"])){
echo html_entity_decode($_GET["body"]);
//echo htmlspecialchars_decode($_GET["body"]);
}
?>
the second page gets the string in the url, but remain empty. so either it's not decoding it right or i missed something simple? the url looks something like this: %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Is there a better way to do this than $_GET? I tried to use a form instead of a link and use post, but it didn't seem to work.
urlencode()is what you should actually be using. urls have length limits, so if body is large you should not use this apporachemailin a different context. if you are just trying to send a string from one page to another, and its to large for the url, post is a good option; otherwise you need to store it locally in a db or a file at least temporarily