Hi,

I have two PHP pages, in first page I have a textbox which will accept the Google Map Embed Link and I want to accept the entered value in the second page and display the corresponding Google Map. But the second page is not receiving the full code, please help me, your direction is much appreciated.

Firstpage.php
<form method="post" name=f1 action="/Secondpage.php">
<input type=text name=t1>
<input type="submit">
</form>

Secondpage.php
<?php
echo $_POST;
?>

Attempt-1
I entered the following code
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=singapore&amp;aq=&amp;sll=42.926027,-85.576072&amp;sspn=0.008704,0.015256&amp;vpsrc=0&amp;ie=UTF8&amp;hq=&amp;hnear=Singapore&amp;t=h&amp;z=10&amp;ll=1.352083,103.819836&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=singapore&amp;aq=&amp;sll=42.926027,-85.576072&amp;sspn=0.008704,0.015256&amp;vpsrc=0&amp;ie=UTF8&amp;hq=&amp;hnear=Singapore&amp;t=h&amp;z=10&amp;ll=1.352083,103.819836" style="color:#0000FF;text-align:left">View Larger Map</a></small>

and getting the following code in the second page which is getting \" and not getting &amp; values
<iframe width=\"425\" height=\"350\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=singapore&aq=&sll=42.926027,-85.576072&sspn=0.008704,0.015256&vpsrc=0&ie=UTF8&hq=&hnear=Singapore&t=h&z=10&ll=1.352083,103.819836&output=embed\"></iframe><br /><small><a href=\"http://maps.google.com/maps?f=q&source=embed&hl=en&geocode=&q=singapore&aq=&sll=42.926027,-85.576072&sspn=0.008704,0.015256&vpsrc=0&ie=UTF8&hq=&hnear=Singapore&t=h&z=10&ll=1.352083,103.819836\" style=\"color:#0000FF;text-align:left\">View Larger Map</a></small>

Note - I tried with stripslashes() function but it only handles the \"

Please let me know if you need more details.

Thanks In Advance

Recommended Answers

All 2 Replies

Member Avatar for cuonic

1. Improve the form code, which is not valid at all :

<form method="post" name="f1" action="/Secondpage.php">
<input type="text" name="t1">
<input type="submit">
</form>

2. The server you are using adds slashes and encodes all html special chars.
So... Use stripslashes(html_entity_decode($_POST);

Thanks for your reply, but its not supporting for the following embed code.


<iframe width="560" height="315" src="http://www.youtube.com/embed/vfW5e6jVsMs" frameborder="0" allowfullscreen></iframe>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.