|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
How do I print a value which the cookie contains?
|
|
#2
|
||||
|
||||
|
This all depends on how your retreiving the cookie. If your using the CGI module it's simply:
$cookie_value = cookie('cookie_name'); Provided the cookie was past by the same domain that's retrieving the cookie. Mickalo
__________________
Thunder Rain Internet Publishing Custom Programming & Database development Providing Personal/Business Internet Solutions that work! |
|
#3
|
|||
|
|||
|
In what ways can I retrieve it? How?
|
|
#4
|
||||
|
||||
|
What programming language are you using?? Perl?? As I say, using the CGI module with your script, is the easiest way. You can generate your own routines to pass or retreive cookies, or use the cookie.lib written by Matt Wright. But using CGI module is the easiest way,..with Perl. PHP seems to utilize the same process as Perl does with the CGI module.
Mickalo |
|
#5
|
|||
|
|||
|
hmm.. i will be using perl.. i can do it in php.. but got kinda lost in perl... could you should me some sample code?
if the cookie name was "help", then what would the code look like? |
|
#6
|
||||
|
||||
|
You need to shift over to the PHP forum to find out about using PHP, but using Perl to retreivie a cookie named help would look something like this:
Code:
#!/usr/bin/perl -w
##################################
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
use strict;
my $cookie_name = cookie('help');
# Now the $cookie_name holds the value of 'help'
print header();
print start_html()
print qq|My Cookie is $cookie_name|;
print end_html();
exit;
Mickalo |
|
#7
|
|||
|
|||
|
Thanx, Ill give this a shot
![]() |
|
#8
|
|||
|
|||
|
It gave me this error
<quote> Software error: Execution of test.cgi aborted due to compilation errors. </quote> |
|
#9
|
|||
|
|||
|
I cut and pasted exactly what you gave me
![]() |
|
#10
|
||||
|
||||
|
Quote:
forgot a semi colon, should be: print start_html(); Plus you have to have a cookie named "help" set in order to retrieve it. You may to check into Stein's book using CGI.pm! Great book ![]() Mickalo |
|
#11
|
|||
|
|||
|
hmmm.. it doesnt give any errors.. but it doesnt print out the value of the cookie
![]() |
|
#12
|
|||
|
|||
|
HELP
kunal http://www.kunal.net/cgi-bin/bleep/ 0 51331456 29470289 864021984 29396946 * this is what the cookie contains.. and the cookie exists.. i dunn see any reason why it shouldnt print it out.. any ideas? |
|
#13
|
||||
|
||||
|
You have to set the cookie called "help" first, then you can retrieve it!
![]() Mickalo |
|
#14
|
|||
|
|||
|
Quote:
this is what the cookie contains.. and the cookie exists.. i dunn see any reason why it shouldnt print it out.. any ideas? |
|
#15
|
||||
|
||||
|
How are you setting the cookie?? What is the name of the cookie your trying to retrieve. Each cookie has a name which is associated to a value: cookie name = it's value. If you set a cookie named "help" it must have a value attached to it.
Mickalo |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > cookies |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|