View previous topic :: View next topic |
Author |
Message |
Arctic -
Joined: 24 Sep 2004 Posts: 560
|
Posted: Sun Feb 06, 2005 4:29 pm Post subject: Help |
|
|
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 |
 |
 |
Glitch2082 -
Joined: 02 Dec 2004 Posts: 194
|
Posted: Sun Feb 06, 2005 6:48 pm Post subject: |
|
|
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 |
|
 |
Arctic -
Joined: 24 Sep 2004 Posts: 560
|
Posted: Sun Feb 06, 2005 6:58 pm Post subject: |
|
|
Is there a way to make it work on the same page? |
|
Back to top |
 |
 |
Glitch2082 -
Joined: 02 Dec 2004 Posts: 194
|
Posted: Sun Feb 06, 2005 7:24 pm Post subject: |
|
|
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 |
|
 |
Arctic -
Joined: 24 Sep 2004 Posts: 560
|
Posted: Sun Feb 06, 2005 7:40 pm Post subject: |
|
|
Nope, still not working D: |
|
Back to top |
 |
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Feb 07, 2005 3:19 am Post subject: |
|
|
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 |
|
 |
|