Jump to content

Header Location


IrishKnights

Recommended Posts

<?

include_once("db.info.inc.php");

 

mysql_connect($dbhost,$dbuser,$dbpass);

@mysql_select_db($dbname) or die( "Unable to select database");

$query="INSERT INTO search (topic, memo) VALUES('$topic', '$notes')";

mysql_query($query);

mysql_close();

 

header("Location: addtopic.php");

exit;

?>

 

What is wrong with this code, it doesn't goto the header.

Link to comment
https://forums.phpfreaks.com/topic/127854-header-location/
Share on other sites

Don't use short-tags, they are not recommend. Also turn on error reporting, if it isn't going anywhere maybe something is happening somewhere.

 

<?php
error_reporting(E_ALL);
   include_once("db.info.inc.php");
   
   mysql_connect($dbhost,$dbuser,$dbpass);
   @mysql_select_db($dbname) or die( "Unable to select database");
   $query="INSERT INTO search (topic, memo) VALUES('$topic', '$notes')";
   mysql_query($query);
   mysql_close();
   
   header("Location: addtopic.php");
   exit;
?>

Link to comment
https://forums.phpfreaks.com/topic/127854-header-location/#findComment-662608
Share on other sites

<?
   include_once("db.info.inc.php");
   error_reporting(E_ALL);
   mysql_connect($dbhost,$dbuser,$dbpass);
   @mysql_select_db($dbname) or die( "Unable to select database");
   $query="INSERT INTO search (topic, memo) VALUES('$topic', '$notes')";
   mysql_query($query);
   mysql_close();
   
   header("Location: addtopic.php");
   exit;
?>

 

Try that and see if you've got any errors.

Link to comment
https://forums.phpfreaks.com/topic/127854-header-location/#findComment-662630
Share on other sites

Warning: Cannot modify header information - headers already sent by (output started at /home/irishknights.co.za/public_html/ss/private/db.info.inc.php:6) in /home/irishknights.co.za/public_html/ss/private/addtopic_func.php on line 11

 

This is the error I get which is:

header("Location: addtopic.php");

and line 6 is:

?>

Link to comment
https://forums.phpfreaks.com/topic/127854-header-location/#findComment-663770
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.