Welcome to WebmasterWorld Guest from 184.73.18.109

Forum Moderators: coopster & jatar k

Pass URL From Form To Iframe

   
6:43 pm on Oct 10, 2008 (gmt 0)

10+ Year Member



Hi all. I stink at PHP and you all rock so heres a question.

I want to make a 2 page app.

Page 1: Simple form that you can enter a url into

Page 2: Takes the URL from the form on page 1 and pops it into an iframe in page 2

Im guessing that somehow the URL on page 1 has to be passed into the URL as a variable and sucked into page 2 between the iframe tags.

Can anyone show me how to do this? Thanks so much.

[edited by: eelixduppy at 6:55 pm (utc) on Oct. 10, 2008]
[edit reason] removed URL [/edit]

6:56 pm on Oct 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



page1.php

<form action=page2.php method=get>
URL:<input type=text name=url size=50>
<br>
<input type=submit value=Load>
</form>

------------------------------------------
page2.php

<?php
$url=mysql_real_escape_string($_REQUEST['url']);

echo "<iframe src ='$url' width='100%'></iframe>";

?>

Sorry in advance to all those who would dislike the html code above, since its not a Validation test.

7:17 pm on Oct 10, 2008 (gmt 0)

10+ Year Member



When i use that I get errors:

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'inter'@'localhost' (using password: NO) in ***** on line 10

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/inter******************* on line 10

7:45 pm on Oct 10, 2008 (gmt 0)

10+ Year Member



i took mysql_real_escape_string out of page 2 and it worked
8:24 pm on Oct 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oops sorry that wasent needed, i think i was sleepy :)
 

Featured Threads

Hot Threads This Week

Hot Threads This Month