473,910 Members | 5,613 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 34293

"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
3210
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
13641
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
2329
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
1563
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
6139
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
7851
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
2341
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
4241
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
1869
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
1571
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
10037
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
9879
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11349
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
10541
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
9727
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
8099
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
7250
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();...
1
4776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4337
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.