|
-
Aug 2nd, 2002, 05:20 PM
#1
Thread Starter
Member
header function
It says in books etc that I shouldn't use header function after data has been sent to the client. What if I want to forward some info to another webpage after recieveing some of it from the user. How do I do it if I can't do it with the header function? or Can I?
-
Aug 2nd, 2002, 06:49 PM
#2
Fanatic Member
you will have to setup a condition or function to do such, something along these lines:
PHP Code:
<?php
if (isset($_REQUEST['url']))
header("Location:".$_REQUEST['url']);
?>
<form method="post" action="?">
<input type="text" name="url" />
<input type="submit" name="submit" value="Go!" />
</form>
-
Aug 3rd, 2002, 08:42 PM
#3
Frenzied Member
you can use the meta tag refresh
<META HTTP-EQUIV="Refresh" Content="5;URL=your site you want to goto.com">
the 5 is how many seconds it will take.
-
Aug 3rd, 2002, 10:11 PM
#4
Stuck in the 80s
Originally posted by phpman
you can use the meta tag refresh
<META HTTP-EQUIV="Refresh" Content="5;URL=your site you want to goto.com">
the 5 is how many seconds it will take.
That wont really work for what he wants.
-
Aug 3rd, 2002, 11:35 PM
#5
Frenzied Member
actually you are right. headers won't work either
What if I want to forward some info to another webpage after recieveing some of it from the user
-
Aug 4th, 2002, 07:04 AM
#6
Fanatic Member
Originally posted by phpman
actually you are right. headers won't work either
My code does what he asked. He takes information from the client and goes to to it as if it were a web address
-
Aug 4th, 2002, 09:56 AM
#7
Frenzied Member
so does this
PHP Code:
<?php
if (isset($_REQUEST['url']))
echo"<META HTTP-EQUIV=\"Refresh\" Content=\"5;URL=".$_REQUEST['url']."\">";
?>
<form method="post" action="?">
<input type="text" name="url" />
<input type="submit" name="submit" value="Go!" />
</form>
-
Aug 4th, 2002, 11:11 AM
#8
Fanatic Member
Originally posted by phpman
so does this
PHP Code:
<?php
if (isset($_REQUEST['url']))
echo"<META HTTP-EQUIV=\"Refresh\" Content=\"5;URL=".$_REQUEST['url']."\">";
?>
<form method="post" action="?">
<input type="text" name="url" />
<input type="submit" name="submit" value="Go!" />
</form>
Yes, but since he asked for a header function I gave an example of one.
-
Aug 4th, 2002, 11:22 AM
#9
Frenzied Member
correct. but he asked what to use if he couldn't use a header function. he will get an error if he sends data to the client and then send the header function. if he doesn't want that error than he can use the meta tag way.
-
Aug 4th, 2002, 09:01 PM
#10
Stuck in the 80s
Originally posted by phpman
correct. but he asked what to use if he couldn't use a header function. he will get an error if he sends data to the client and then send the header function. if he doesn't want that error than he can use the meta tag way.
Matt's function works fine. He will not get an error with it and it is much more efficient.
And he did ask what to do if he couldn't use it, but he also added "or can I?" and that's what Matt was answering. That he could. Which voided the first question.
But I won't argue this thread anymore.
-
Aug 4th, 2002, 09:29 PM
#11
Frenzied Member
if data has been sent to the client (outputed to the screen) he will get headers already sent error.
that is why my function works better than Matt's.
but whatever.
-
Aug 4th, 2002, 09:46 PM
#12
Stuck in the 80s
Exactly where in Matt's example is there data output before the header function?
-
Aug 4th, 2002, 11:00 PM
#13
Frenzied Member
no where but the question was
It says in books etc that I shouldn't use header function after data has been sent to the client. What if I want to forward some info to another webpage after recieveing some of it from the user.
-
Aug 5th, 2002, 01:42 AM
#14
Stuck in the 80s
Matt's script showed him how to fix that.
Do we have to go round and round?
-
Aug 10th, 2002, 05:05 AM
#15
Thread Starter
Member
Sorry for not replying for so long.
Thx for all the help. I finally got it working.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|