Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

header ("Location:.........

Status
Not open for further replies.

JamesGMills

Programmer
Aug 15, 2005
157
GB
OK... so over and over i have the problem of not being able to add the header location below any other code.

My question is how do i go about doing the below if i can not get the id first?

include ("inc_functions.php");
$sectionName = $_POST['sectionName'];
$q = functionQuery("INSERT INTO sections (id, name) VALUES ('', '$sectionName')");
$id = mysql_insert_id();
header ("Location: section_editor.php?section=$id");
 
av a look at this very well:
header ("Location: section_editor.php?section=$id");
probably its coz u spaced header and (
.so it should be this:
header("Location: section_editor.php?section=$id");
if that doesnt work, then it may be something else. saying exactly the error returned may help know what is wrong.
Good luck.

 
If you need to have any output before headers are sent, you will need to use one of the client side redirecting, such as meta refresh or javascript. However, if there is no output before header function, you should have no problems using it. If you're getting the 'headers already sent' error check your code for any output before the actual call to header function and see if you can get rid of that. Caution: Even whitespace before the initial <?php opening tag counts as output.
 
my god... i just took another look and had a look at the error and my inc_functions file actually has a number of other includes in it and it was actually in my database connection file... there was a space after the closing tags of ?>

thanks for making me look harder :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top