curlytail Posted January 15, 2010 Share Posted January 15, 2010 Hi all. My first post! I am not a PHP programmer (sorry .NET man :-\) but have been asked to add an image resizing script into a php page. The page in question processes form data ready for a MYSQL query after uploading and resizing images. This work successfully; images resized and uploaded and query posted no problem. The problem is that the closing commands which redirect the page are not being excuted. Here are the bare bones of the last part of the page: $catInfo = explode("|", $_POST[selectCategory]); $CategoryID = $catInfo[0]; $SubcategoryID = $catInfo[1]; $q1 = "insert into etc . . . ."; mysql_query($q1); $last = mysql_insert_id(); } header("location:info.php?id=$last"); exit(); ?> The page however remains blank and does not redirect. My knowledge of programming, whilst pretty profound, doesn't extend to PHP and I don't have the time to learn the entire language to debug this part. Is this a common fault and one easily remedied? If someone can point me int he right direction I'd be very grateful. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/188580-newbie-with-unexpected-termination-of-page/ Share on other sites More sharing options...
Buddski Posted January 15, 2010 Share Posted January 15, 2010 header("Location: info.php?id=$last"); Quote Link to comment https://forums.phpfreaks.com/topic/188580-newbie-with-unexpected-termination-of-page/#findComment-995611 Share on other sites More sharing options...
premiso Posted January 15, 2010 Share Posted January 15, 2010 Add this to the top of your page: <?php error_reporting(E_ALL); ini_set("display_errors", 1); If there are any errors (my bet is that "Output already Sent" error) then it will display them. If it is the output already sent, you cannot have any output (not even a whitespace at the top before <?php) to the browser before you call a header, as once output has been sent you are already in the body. Quote Link to comment https://forums.phpfreaks.com/topic/188580-newbie-with-unexpected-termination-of-page/#findComment-995613 Share on other sites More sharing options...
calmchess Posted January 15, 2010 Share Posted January 15, 2010 header("Location:info.php?id=$last"); Quote Link to comment https://forums.phpfreaks.com/topic/188580-newbie-with-unexpected-termination-of-page/#findComment-995614 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.