header() Function

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I hope someone can help me.   Basically I have a FORM in my php
script.  The form is processed, and then using Javascript, I validate
the form, and when everything is good, I call another PHP script to
store the data.

Here is the code which calls the SAVE DATA routine:

            <TD class="topnav" bgcolor="#00FF00"><a
href="savedata.php" onclick="if ('preventDefault' in event)
                { event.preventDefault(); }
             else { event.returnValue = false; }
             formvalidation(document.forms['Add_Party']);">SAVE DATA</

Here is the FORM info:

<FORM NAME='Add_Data'  ACTION="savedata.php" METHOD=POST"
onsubmit="return formvalidation(this)">

And finally, within savedata.php, here is my header command:

header("Location: http://www.domain.com/add_data.php ");

The problem is, all I get is a blank page and a HUGE url containing
all the values passed from the form to the savedata.php script.

Why the blank page?  Why does it not re-direct??

Thank you.


Re: header() Function

On Sun, 23 Mar 2008 21:34:53 -0700, mtek wrote:

Quoted text here. Click to load it


header( "HTTP/1.1 303 Continue Here" );
header( "Status: 303 Continue Here" );
header( "Location: http://www.domain.com/add_data.php " );

Tobias Blomkvist

Re: header() Function

mtek@mtekusa.com wrote:
Quoted text here. Click to load it

Who knows?  You gave us a few pieces of information, and that's all.

First of all - do you have error_reporting enabled and errors being
displayed?  That's always the first place to start.  In your PHP.INI
file you should have:


Also, look at the source code for the page in your browser - did you in
fact get something which isn't being displayed?

If that all fails, I suggest you trim it down to the minimum required to
show the problem then post the code for both pages.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: header() Function

Quoted text here. Click to load it

I don't know if you're making a really basic error here, but just in case:

You need to use PHP to validate the form responses.  Javascript validation
is a nice user-friendly feature, but it provides zero security.

Site Timeline