Jump to content

[SOLVED] setcookie, headers


w1ww

Recommended Posts

Hello.

 

I searched google and found that the headers already sent problem error is returned if theres a white space. Still, on my script there's nothing on the first line.

 

<?php

ob_start();
$inTwoMonths = 60 * 60 * 24 * 60 + time();
setcookie('lastVisit', date("Y-m-d G:m:s"), $inTwoMonths);
ob_end_flush();

//show form
if (!isset($_POST['sub'])){
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<head><title>Ajuntamento do Pandalho</title>

 

This are the first lines of my script.

 

Why do I keep getting "Warning: Cannot modify header information - headers already sent by (output started at D:\wamp\www\pandalho\index.php:1) in D:\wamp\www\testing\index.php on line 5"

 

Thank you.

 

Link to comment
Share on other sites

Warning: Cannot modify header information - headers already sent by (output started at D:\wamp\www\pandalho\index.php:1) in D:\wamp\www\pandalho\index.php on line 5

 

This is the right error. Sorry.

 

In the first line there is a single <?php tag without any spaces!

 

Thank you!

Link to comment
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.