Help

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Arctic
-


Joined: 24 Sep 2004
Posts: 560

PostPosted: Sun Feb 06, 2005 4:29 pm    Post subject: Help Reply with quote

Code:
<form method=POST action="action.php">
Address: <input type='text' name='msg'>
<input type="submit" value="Submit">
</form>
<br>
<?php
$msg=$_POST['msg'];
echo "<iframe src=http://$msg width=750 height=100%>";
?>


How do I get the action to point to the PHP code near the bottom? (I'm trying to evade the school restrictions on websites again)
Back to top View user's profile Send private message ICQ Number
Glitch2082
-


Joined: 02 Dec 2004
Posts: 194

PostPosted: Sun Feb 06, 2005 6:48 pm    Post subject: Reply with quote

The action in the form is 'action.php' ... so you can't echo it on the same page. Heres something to use for action.php

Code:

<?

//action.php

setcookie('msg', $_POST['msg']);
header('Location: the_first_page.php');

?>


And instead of using the echo <iframe> use this

Code:

<!-- THis is just html -->
<iframe src='<? $_COOKIE['msg']; ?> width=** height=**></iframe>

_________________
int main() {
cout << "Im Pro Apache";
cin.get();
}
Back to top View user's profile Send private message Send e-mail
Arctic
-


Joined: 24 Sep 2004
Posts: 560

PostPosted: Sun Feb 06, 2005 6:58 pm    Post subject: Reply with quote

Is there a way to make it work on the same page?
Back to top View user's profile Send private message ICQ Number
Glitch2082
-


Joined: 02 Dec 2004
Posts: 194

PostPosted: Sun Feb 06, 2005 7:24 pm    Post subject: Reply with quote

My code would bassicaly do it on the same page since it will redirect to that page but you can use this:

Code:

<form method=post action='<? $_PHPSELF ?>'>


This way you don't need the code i put, all you need is what you had.
_________________
int main() {
cout << "Im Pro Apache";
cin.get();
}
Back to top View user's profile Send private message Send e-mail
Arctic
-


Joined: 24 Sep 2004
Posts: 560

PostPosted: Sun Feb 06, 2005 7:40 pm    Post subject: Reply with quote

Nope, still not working D:
Back to top View user's profile Send private message ICQ Number
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Feb 07, 2005 3:19 am    Post subject: Reply with quote

Glitch2082,

The following code doesn't work on all PHP configurations (it depends on global variables fro example) and hs a minor typing error:
Code:

<form method=post action='<? $_PHPSELF ?>'>


It's better to replace it with the more universal code:

Code:

<form method=post action='<?php echo $_SERVER['PHP_SELF']; ?>'>

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group