homepage Welcome to WebmasterWorld Guest from 54.167.75.155
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Pass URL From Form To Iframe
narsticle




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

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]

 

Anyango




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

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.

narsticle




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

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

narsticle




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

i took mysql_real_escape_string out of page 2 and it worked

Anyango




msg:3763235
 8:24 pm on Oct 10, 2008 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved