Jump to content

Headers help needed!


themistral

Recommended Posts

Guys, this is driving me mental!

 

Just to let you know, this isn't down to code being sent to the browser before the headers.

 

Basically, I have a form - the form action processes a function which should insert the information into the database and redirect to a thank you page.

 

The info is inserted but the redirect doesn't work...

I have tried hard coding it but I still can't seem to make it work...

 

This is beginning of my page

 

<?php session_start(); ?> 
<?php include('includes/functions.inc.php'); ?>
<?php
// process add review
if (isset($_POST['but_add_review'])) {
funcReviewAdd('http://www.myurl.com/page-name.html');
}

 

The function is

 

function funcReviewAdd($redirect) {
// connect to the database
funcConnect();
// add to the database
the code here works - insert query
// redirect page
header('Location:'.$redirect);
}

 

I have echoed $redirect and is getting the right value parsed, it's just the redirect not working...

 

Please help!!

Link to comment
https://forums.phpfreaks.com/topic/89970-headers-help-needed/
Share on other sites

Changed to

 

header('Location:'.$redirect);
exit();

 

and still shows a blank page...

 

I'm going to comment out all functions not required and see if there is a weird problem (maybe whitespace or something) in my functions file.

 

Will let you know what happens!

Link to comment
https://forums.phpfreaks.com/topic/89970-headers-help-needed/#findComment-461605
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.