Solved

Cookies

Posted on 1998-11-25
3
159 Views
Last Modified: 2010-03-04
I am trying to set up a PERL script that prints a web page to the screen as well as setting a cookie up on the client. When I try to do this with the following code:

print "Set-Cookie: id=$id\;";
print "Content-type:text/html\n\n";
print<<web;
 <HTML>
<head><title></head></title>
<body bgcolor=white>
  <CENTER>
 <table width=450>
<th bgcolor=navy colspan=4><center><font color=yellow>The Following was added to
 your shopping basket:</font></center></th>
<tr bgcolor=yellow>
    <td>Quantity</td>
And so on....

It ends up setting the cookie, but then prints all the HTML code as plain text. Anyone know why this is happening and how to prevent it?

Thanks
0
Comment
Question by:rrivers
  • 2
3 Comments
 
LVL 4

Expert Comment

by:martinag
Comment Utility
Does this work for you?
print "Set-Cookie: id=$id\n";

Martin
0
 

Author Comment

by:rrivers
Comment Utility
That $##%#$ did it! I had no idea those stupid little new line characters were so improtant!
The points are yours..
0
 
LVL 4

Accepted Solution

by:
martinag earned 100 total points
Comment Utility
Thanks.

Martin
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now