Jump to content

Recommended Posts

i made lot of changes deleted white spaces but still on getting this error

Warning: Cannot modify header information - headers already sent by (output started at /home/supreme/www/www/freeoffer.php:9) in /home/super/www/www/freeoffer.php on line 44

please helpme.This is my file freeoffer.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<meta name="description" content="" />

<meta name="keywords" content="" />

<link href="favicon.ico" rel="shortcut icon"/>

<meta name="verify-v1" content="" />

<?php include("includes/meta.inc");?>

<?php include("includes/css.inc");?>

<?php include("includes/javascript.inc");?>

</head>

<?php

$code= $_POST['code'];

$myServer = "localhost:/tmp/mysql5.sock";

$myUser = "super";

$myPass = "195410";

$myDB = "super_phpDealerLocator";

$dbhandle = mysql_connect($myServer, $myUser, $myPass);

if(!$dbhandle)

{

    die('Could not connect: ' . mysql_error());

}

//echo 'Connected successfully';

 

// connection to the database

 

$db = mysql_select_db($myDB, $dbhandle)or

die("Couldn't open database $myDB");

// select a database to work with

$query="SELECT *";

$query.="FROM `codeforfreebar`";

$query.="WHERE `m_code` LIKE '%$code'";

 

// //execute the SQL query and return records

        $result = mysql_query($query,$dbhandle);

// display rows or products returned

      $num_rows = mysql_num_rows($result);

if($num_rows==1)

{

header("Location: survey.php");

}

else

{

echo 'error on page';

}

?>

<body<?php include("includes/body_onload.inc"); ?>>

<div align="center">

<a name="top" rel="nofollow"></a>

 

<table width="780" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td valign="top" style="height:57px;">

    <!-- -->

    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="height:57px;">

      <tr>

        <td style="width:292px;" valign="bottom"><a href="index.php" title="Supreme Protein Products"><img src="images/logo_top.jpg" alt="Supreme Protein" /></a></td>

        <td style="width:100%;" valign="bottom">

<div align="right">

<?php include("includes/header_text.inc"); ?>

        </div>

        <br />

        <?php include("includes/nav.inc"); ?></td>

      </tr>

    </table>

  </td>

  </tr>

  <tr>

    <td style="height: 51px;" valign="top" align="left">

    <div class="float1"><img src="images/layout/bk-logo-bottom-revamp.jpg" alt="image" width="780" height="51" /></div>

    <div class="float2">Protein Quality</div></td>

  </tr>

<!-- to fix -->

  <tr>

    <td id="body" style="background-color:#FFFFFF; border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:1px; border-right-color:#000000; border-right-style:solid; border-right-width:1px; border-left-color:#000000; border-left-style:solid; border-left-width:1px; padding:20px;" valign="top" align="left">

    <div align="center" id="mydiv" class="copy">

      <form action="<?php echo $PHP_SELF;?>" method="POST">

        <br/><br/>

<h3>Please enter the keycode:    <input type="text" name="code" size="20" value="<?php echo  $_POST

 ?>"></h3>
             <br/>
             
<input type="submit" value="submit" name="submit">

</form>
</div>
       
    </td>
  </tr>

  <tr>

    <td valign="bottom">
<div>
    <!-- BEGIN BOTTOM 3 -->
    <?php include("includes/footer_images.inc"); ?>
    <!-- END BOTTOM 3 -->    
    <?php include("includes/footer_text.inc"); ?></td>
  </tr>
</table>
</div>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/188336-cannot-modify-header-information/
Share on other sites

Read the STICKY (link posted above)

 

This must come before any screen output.

header("Location: survey.php");

i.e.

<?php
if($_GET['x']) {
header("Location: survey.php");
exit();
}
?>
<html>
<body>
<p>some content</p>

 

On another note, the code you have posted contains the username and password from your database connection. Be careful when posting snippets of code.

i went through it and made some changes to it by placing the code top of the html but still i am getting the error

Not sure whatis the error at freeofferphp:2.

 

i already spent half of the day on it and still couldn't fix it please help me

 

Warning: Cannot modify header information - headers already sent by (output started at /home/super/www/www/freeoffer.php:2) in /home/super/www/www/freeo

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?php

$code= $_POST['code'];

$myServer = "localhost:/tmp/mysql5.sock";

$myUser = "supreme";

$myPass = "19541140";

$myDB = "supreme_phpDealerLocator";

$dbhandle = mysql_connect($myServer

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.