Page 1 of 1

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

Posted: Wed Dec 05, 2007 4:42 am
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.

Posted: Thu Dec 06, 2007 6:42 pm
by nathanr
try putting a space after location:

Posted: Fri Dec 07, 2007 6:08 pm
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!!