Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.