RE: [PHP] Header Redirect POST

2004-03-26 Thread Ford, Mike [LSS]
On 25 March 2004 20:17, Chris Thomas wrote:

 I am not sure if this was designed like this, or if its just
 something im doing wrong.
 
 Im posting some data to a processing page, where i handle it then use
 Header('Location: other.php') to direct me to another page.
 
 The problem that im running into is that the posted data is available
 in other.php.
 I would like to get it so that in other.php $_POST  should be
 an empty array

At a guess, you're using Apache and it's doing an internal redirect because you've 
used a relative pathname (so the file must be in the same document root!); in this 
case, Apache just does a silent internal substitution of the redirect page, and all 
data associated with the context will remain intact -- there is no round-trip back to 
your browser.

If you use an absolute URL in the Location: header, Apache will return the redirect to 
your browser -- and because your browser now knows it's a genuine new request, the 
POST data is not resent.

The trick is to look at the URL appearing in your browser's address bar -- if it stays 
as the originally requested address, Apache did an internal redirect; if it changes to 
the redirect address, it was an external redirect which round-tripped to your browser.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Header Redirect POST

2004-03-25 Thread Jason Giangrande
Chris Thomas wrote:
I am not sure if this was designed like this, or if its just something im
doing wrong.
Im posting some data to a processing page, where i handle it then use
Header('Location: other.php') to direct me to another page.
The problem that im running into is that the posted data is available in
other.php.
I would like to get it so that in other.php $_POST  should be an empty array
Any suggestions??

Chris

If the processing page and other.php page are two separate pages I don't 
see how you could be getting the same $_POST data that the processing 
page is receiving.  You aren't passing any data from your processing 
page to hidden form inputs (or something) on that page before you call 
header() are you?  Perhaps if you gave an example of your code I might 
have a better idea of what is going on.  You could also try using 
unset($_POST) in other.php to make sure $_POST is empty for that page.

--
Jason Giangrande [EMAIL PROTECTED]
http://www.giangrande.org
http://www.dogsiview.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Header Redirect POST

2004-03-25 Thread Chris Shiflett
--- Chris Thomas [EMAIL PROTECTED] wrote:
 Im posting some data to a processing page, where i handle it then use
 Header('Location: other.php') to direct me to another page.

The Location header requires an absolute URL.

 The problem that im running into is that the posted data is available
 in other.php.

I think you made a typo or you're misinterpreting something. The URL
referenced in a Location header will be requested with a GET request, so
it is impossible that any POST data exists.

Chris

=
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
 Coming Fall 2004
HTTP Developer's Handbook - Sams
 http://httphandbook.org/
PHP Community Site
 http://phpcommunity.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Header Redirect POST

2004-03-25 Thread Chris W. Parker
Chris Shiflett mailto:[EMAIL PROTECTED]
on Thursday, March 25, 2004 1:01 PM said:

 I think you made a typo or you're misinterpreting something. The URL
 referenced in a Location header will be requested with a GET request,
 so it is impossible that any POST data exists.

alright cool. now we've got three chris's in a row!!



chris.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Header Redirect POST

2004-03-25 Thread Chris Thomas

Here is a url with the problem that i was describing
http://xiot.darktech.org

I fiddled and I found what the problem.

Header('Location: $calling)  the first char in $calling can not be a
/
I was setting $calling with $_SERVER['PHP_SELF'] which adds the / in front
of the path.
I changed it to . . $_SERVER['PHP_SELF'] and it worked

take a look at the url to see what was going on.

Here is the code that im using

--index.php
print_r($_POST);
...
echo form action='poll.php' method='POST';
echo input name='poll_id' type='hidden' value='1\n;
echo input name='calling' type='hidden' value='  .
$_SERVER['PHP_SELF'] .  '\n;
echo input name='poll_choice' type='radio' value=1Choice 1;
echo input name='poll_choice' type='radio' value=2Choice 2;
echo input name='poll_choice' type='radio' value=3Choice 3;

echo input type='submit' value='submit';
echo /form;


--poll.php
$poll_id = $_POST['poll_id'];
$poll_choice = $_POST['poll_choice'];
$calling = $_POST['calling'];

if (isset($poll_id)) {
unset($_POST);
castVote($poll_id, $poll_choice);
Header(Location: $calling);
exit();
}


Chris

Jason Giangrande [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Chris Thomas wrote:
  I am not sure if this was designed like this, or if its just something
im
  doing wrong.
 
  Im posting some data to a processing page, where i handle it then use
  Header('Location: other.php') to direct me to another page.
 
  The problem that im running into is that the posted data is available in
  other.php.
  I would like to get it so that in other.php $_POST  should be an empty
array
 
  Any suggestions??
 
  Chris
 

 If the processing page and other.php page are two separate pages I don't
 see how you could be getting the same $_POST data that the processing
 page is receiving.  You aren't passing any data from your processing
 page to hidden form inputs (or something) on that page before you call
 header() are you?  Perhaps if you gave an example of your code I might
 have a better idea of what is going on.  You could also try using
 unset($_POST) in other.php to make sure $_POST is empty for that page.

 -- 
 Jason Giangrande [EMAIL PROTECTED]
 http://www.giangrande.org
 http://www.dogsiview.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php