Jump to content

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

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.