Because there is no complete code, I'm not sure, but I think: you already have code above the cookie. The cookie has to come before any other: e.a. 1 <?PHP 2 "cookie" 3 ?> 4 <HTML> 5 <HEAD> etc. Jacco "Steve Dodkins" <Steve.Dodkins@ebm-ziehl.co.uk> wrote in message 416B83EEF0C5D4119731000255589B77A3BC67@ebmnt01">news:416B83EEF0C5D4119731000255589B77A3BC67@ebmnt01... > Hi > > I'm trying to use the following simple script to set cookies but get the > following error message > > "cannot add header information - headers are already sent by(output started > at c:\program files\php home edition 2\www\listing19.1.php:3) in c:\program > files\php home edition 2\www\listing19.1.php on line 4 > > 3 <?php > 4 setcookie( "vegetable", "artichoke", time()+3600, "/", $SERVER_NAME, > 0 ); > 5 ?> > 6 <html> > 7 <head> > 8 <title>Listing 19.1</title> > 9 </head> > 10 <body> > 11 <?php > 12 if ( isset($vegetable ) ) > 13 print "<p>hello again your chosen veg is $vegetable</p>"; > 14 > 15 else print "<p>hello your 1st visit ?</p>"; > 16 > 17 ?> > 18 > 19 </body> > 20 </html> > > > Regards > > Steve Dodkins > > IMPORTANT NOTICE The information in this e-mail is confidential and should > only be read by those persons to whom it is addressed and is not intended to > be relied upon by any person without subsequent written confirmation of its > contents. ebm-ZIEHL (UK) Ltd. cannot accept any responsibility for the > accuracy or completeness of this message as it has been transmitted over a > public network. Furthermore, the content of this e-mail is the personal > view of the sender and does not represent the advice, views or opinion of > our company. Accordingly, our company disclaim all responsibility and accept > no liability (including in negligence) for the consequences of any person > acting, or refraining from acting, on such information prior to the receipt > by those persons of subsequent written confirmation. In particular (but not > by way of limitation) our company disclaims all responsibility and accepts > no liability for any e-mails which are defamatory, offensive, racist or in > any other way are in breach of any third party's rights, including breach of > confidence, privacy or other rights. If you have received this e-mail > message in error, please notify me immediately by telephone. Please also > destroy and delete the message from your computer. Any form of reproduction, > dissemination, copying, disclosure, modification, distribution and/or > publication of this e-mail message is strictly prohibited. If you have > received this E-mail in error, or suspect that the message may have been > intercepted or amended, please notify ebm-ZIEHL (UK) Ltd on +44(0)1245 > 468555. > ebm-ZIEHL (UK) Ltd Chelmsford Business Park, Chelmsford, Essex CM2 5EZ > > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php