[SOLVED]header("location... - Page cannot be displayed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mcccy005
Forum Contributor
Posts: 123
Joined: Sun May 28, 2006 7:08 pm

[SOLVED]header("location... - Page cannot be displayed

Post by mcccy005 »

I have a data form which is basically linked to itself (ie. <form name ... action=current_page...>
Once the page is validated, it automatically redirects the webpage to a different page.
This works fine with whatever fields I have in the form (text field, select field etc.). However if I add a file field in, the page won't redirect.

For example, this code will result in the page redirecting:

Code: Select all

$region_info=new input_page("region_information",
                               array(new text_field("Region Name", "region_name", 20, 30),
                                        new select_field("State/Territory", "region_state", $states, "state")),
                                $region_info_query);
but this code DOESN'T result in the page redirecting (it simply comes up with the "page cannot be displayed" error (and the URL in the URL bar doesn't change either) ):

Code: Select all

$region_info=new input_page("region_information",
                      array(new text_field("Region Name", "region_name", 20, 30),
                                new select_field("State/Territory", "region_state", $states, "state"),
                                new file_field("Upload Images", "uploaded_files", 6, "S:/web_pages/uploads/")),
	       $region_info_query);

...and this is the code I use to redirect a page:

Code: Select all

//If this is the last page of the result_set
else
{
	session_unset( );
	header("location:$this->final_page");
}
Also, the files upload to the web server fine - there are no error there.
I've tried changing the "location:$this->final_page" to an actual webpage such as "http://forums.devnetwork.net" but that doesn't change anything.
Thanks in advance.

Edited: 6/12/07. Also, when I use the same code as above and I specify in the new form field to redirect the page to a DIFFERENT page (rather than the same current page), this works fine also.
Last edited by mcccy005 on Fri Dec 07, 2007 6:09 pm, edited 1 time in total.
User avatar
nathanr
Forum Contributor
Posts: 200
Joined: Wed Jun 07, 2006 5:46 pm

Post by nathanr »

try putting a space after location:
mcccy005
Forum Contributor
Posts: 123
Joined: Sun May 28, 2006 7:08 pm

Post by mcccy005 »

Thanks for that - worked a treat. Funny that though - every related piece of advice I found on the Internet explicitly said to NOT put a space there!!
Post Reply