npsari Posted July 6, 2009 Share Posted July 6, 2009 Hello there, I need to redirect to a page, however, I must insert some data into the databse first The problem is, people tell me that the redirect code must be the first thing on page <?php header ("Location: $URL"); ?> How can I insert data then redirect to a page? Link to comment https://forums.phpfreaks.com/topic/164976-solved-redirect-to-a-page-after-database-connection/ Share on other sites More sharing options...
rhodesa Posted July 6, 2009 Share Posted July 6, 2009 The redirect doesn't have to be the first thing on the page, it just has to be before anything is outputted. So, feel free to run all the PHP code you want, just don't have anything print Link to comment https://forums.phpfreaks.com/topic/164976-solved-redirect-to-a-page-after-database-connection/#findComment-869934 Share on other sites More sharing options...
npsari Posted July 6, 2009 Author Share Posted July 6, 2009 wow man, your answer was correct I removed all the print and echo bits Now it works Thank you for the help Link to comment https://forums.phpfreaks.com/topic/164976-solved-redirect-to-a-page-after-database-connection/#findComment-869955 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.