473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

php header() help

bob
I use the following code to redirect the browser on an error,
header("location:error.php");
exit;

Is it possible to pass POST variables on as if a form was submitted, using
header()?

Thanks for your help,

Ben.
Jul 17 '05 #1
5 34273

"bob" <sp**@wrathofthebarclay.co.uk> wrote in message
news:3f***********************@mercury.nildram.net ...
I use the following code to redirect the browser on an error,
header("location:error.php");
exit;

Is it possible to pass POST variables on as if a form was submitted, using
header()?

Thanks for your help,

Ben.


I suppose, if you wanted to turn them into GET vars.
You could do something like this...

<?
$url = "error.php?";
while(list($key, $value) = each($HTTP_POST_VARS))
$url .= $key . "=" . $value . "&";
header("Location: $url");
?>

Jul 17 '05 #2
Use the status code 307.

header("HTTP/1.0 307 Temporary Redirect");
header("Location: error.php");

Uzytkownik "bob" <sp**@wrathofthebarclay.co.uk> napisal w wiadomosci
news:3f***********************@mercury.nildram.net ...
I use the following code to redirect the browser on an error,
header("location:error.php");
exit;

Is it possible to pass POST variables on as if a form was submitted, using
header()?

Thanks for your help,

Ben.

Jul 17 '05 #3
Regarding this well-known quote, often attributed to bob's famous "Fri, 5
Dec 2003 00:32:11 -0000" speech:
I use the following code to redirect the browser on an error,
header("location:error.php");
exit;

Is it possible to pass POST variables on as if a form was submitted, using
header()?

Thanks for your help,

Ben.


You could GET, I imagine, by using something like--

Location: error.php?error=404

--but I imagine POSTing is out of the question...

Or, are you asking if POSTed variables, POSTed to a page that errors out,
can be preserved? That, I'm not sure... I'll have to check on that...
there'd be some interesting processing ideas there, I imagine.

--
-- Rudy Fleminger
-- sp@mmers.and.evil.ones.will.bow-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #4
*** bob wrote/escribió (Fri, 5 Dec 2003 00:32:11 -0000):
I use the following code to redirect the browser on an error,
header("location:error.php");
exit;

Is it possible to pass POST variables on as if a form was submitted, using
header()?


You can process POST data normally in the document where you've placed
header() function. However, you can't send feedback to browser. If you
need so you should pass GET data to the redirected page:

$name=trim($_POST['name']);
$result=insert_name_into_database($name);
header('Location: http://www.site.com/error.php?result='.urlencode($result));
exit;
--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Jul 17 '05 #5
bob wrote:
I use the following code to redirect the browser on an error,
header("location:error.php");
exit;

Is it possible to pass POST variables on as if a form was submitted, using
header()?


PEAR are your friend in this case :)

http://pear.php.net/package/HTTP_Request

Otherwise you can find a class to do HTTP Post requests at:
http://phpclasses.upperdesign.com/br...ml/package/375

Regards,
Johan

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Thomas Kemmerich | last post by:
hi, i'm looking for a possibility to start a download. here is my current code: header("Content-Type: $_contenttype"); header("Content-Disposition: attachment; filename=\"$_filename\"");...
18
by: Frank Thorstens | last post by:
Hi, i try to give my script headers so the output text would be downloaded in the client's browser and not displayed. But it doesn't work at all in my IE 6 and Opera. <?...
11
by: DaRemedy | last post by:
Hiya, just need help with PHP headers. I have an index php page which has the following code within a header redirect: <?php if ( empty($_GET) ) if (empty($_GET) ) { $month = date(n);
0
by: Luke Airig | last post by:
I am using the Saxon engine and I have an xml file that contains batches of records. Each batch starts with a header record and the associated detail records immediately follow each header. There...
2
by: Karthik | last post by:
When I try to compile my VC++ program (am Using VS6.0). I get the following error in a header file ATLCONV.H. c:\program files\microsoft visual studio\vc98\atl\include\atlconv.h(52) : error...
4
by: Matthew Harvey | last post by:
Hello, I am having a problem getting a custom soap header to work with PHP5. What I require is something like this: <SOAP-ENV:Header> <USER>myusername</USER> <PASSWORD>mypassword</PASSWORD>...
3
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
2
by: saleek | last post by:
I was wondering if there is a way I can add an extra header to a datagrid? I found this solution on the internet - but it seems quite old and didn't work for me. ...
3
by: jszczepankiewicz | last post by:
Witam, mam nastepujacy problem: XSLT 2.0, Hi, i've got following problem with xslt 2: my xml doc looks something linke: <manual>
10
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello misters, I have an DAtalist that generates an html table with a header. There are many rows, and I want that it appears scroll horizontal and vertical, and the header be fixed. Any help...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.