473,779 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

php header() help

bob
I use the following code to redirect the browser on an error,
header("locatio n: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 34290

"bob" <sp**@wrathofth ebarclay.co.uk> wrote in message
news:3f******** *************** @mercury.nildra m.net...
I use the following code to redirect the browser on an error,
header("locatio n: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("Locatio n: $url");
?>

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

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

Uzytkownik "bob" <sp**@wrathofth ebarclay.co.uk> napisal w wiadomosci
news:3f******** *************** @mercury.nildra m.net...
I use the following code to redirect the browser on an error,
header("locatio n: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("locatio n: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.ev il.ones.will.bo w-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("locatio n: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($_PO ST['name']);
$result=insert_ name_into_datab ase($name);
header('Locatio n: http://www.site.com/error.php?resul t='.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("locatio n: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
3201
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\""); // flush();
18
13625
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. <? header("Content-Type: application/octet-stream"); header("Content-Length: 5"); header("Content-Transfer-Encoding: binary");
11
2317
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
1556
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 can be multiple batches in a single file, each batch indicated by a new header. I need to create a tab-delimited output file that appends all of the header record fields in front of each associated detail record within the same batch. The...
2
6133
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 C2065: '_ASSERTE' : undeclared identifier Error executing cl.exe. and it points to inline LPWSTR WINAPI AtlA2WHelper(LPWSTR lpw, LPCSTR lpa, int nChars,
4
7846
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> </SOAP-ENV:Header> What I get is : <SOAP-ENV:Header>
3
2336
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. Also, I am using a "Report Header" to show a count of how many total labels that are being printed. Now, my problem is that without the "Report Header", the spacing is perfect. But, when I add the Report Header, it gets shifted downwards and the...
2
4236
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. http://www.dotnet247.com/247reference/msgs/13/69744.aspx It recommends the following: Private Sub DataGrid1_PreRender(ByVal sender As Object, ByVal e As
3
1866
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
1565
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 ? Thanks in advance. -- http://www.alhambra-eidos.es/web2005/index.html www.kiquenet.net
0
9636
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9930
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6724
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5503
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.