[Typo3] cookies

Jody Cleveland Cleveland at winnefox.org
Wed May 11 20:43:59 CEST 2005


Hi Christian,

> I don't know if I get you right, but I hope I do:
> 
> Your question is not really regarding typo3. If you want to send 
> something with a form you have to put it inside a form field in HTML. 
> Later you can read it out with the HTTP_GET_VARS in php or in typo3 
> t3lib_div::_GET()
> (see 
> http://typo3.org/documentation/document-library/doc_core_cgl/V
ariables_and_Consta/)
> Maybe in your case it is automatically read out and sent.
> 
> If you want to have something submitted just use a (hidden) 
> input field 
> like this:
> 
> <HTML>
> ...
> <?php
> 
> $yourcontent = 'Cookies are accepted';
> 
> ?>
> ...
> <FORM ...>
> <input type="hidden" name="whateveryoulike" value="'.$yourcontent.'">
> </FORM>
> 
> </HTML>

Here's a few more details:

My question is about the following page:
http://www.wals.lib.wi.us/oshkosh/index.php?id=380

This page is made up of three content elements.  

1) The first content element is a TEXT element that includes the header
and explanatory text.  

2) The second content element is a PHP SCRIPT element containing the
following code:

<?php
if (isset($_COOKIE["Setting"]))
$cookie_setting= "Cookies are " . $_COOKIE["Setting"];
else
$cookie_setting= "Cookies are not accepted";

echo $cookie_setting;
?>

The ECHO statement correctly provides me with my desired result onscreen
(Either 'Cookies are accepted' or 'Cookies are not accepted'.)  

3) My final content element is a FORM element.  I want to receive in the
resulting email the content of my $cookie_setting variable set and
correctly echoed earlier.  I'm struggling with what to insert in the
line that is fourth from the bottom (the Cookie_Setting=hidden line).  

Name: | name=input,40
Email: | *email=input,40
Library card barcode number: | *barcode=input,40
Problem description: | problem=textarea,43,5
<snip>
| Cookie_Setting=hidden | ???????????????????
 | formtype_mail=submit | Send request!
 | html_enabled=hidden | 1
 | subject=hidden | OPL Electronic Resource Request

After reviewing the Variables and Constants information
(http://typo3.org/documentation/document-library/doc_core_cgl/Variables_
and_Consta/) I tried the following options:

Form def: | Cookie_Setting=hidden | t3lib_div::getIndpEnv();
Email: COOKIE_SETTING t3lib_div::getIndpEnv();  

Form def: | Cookie_Setting=hidden | t3lib_div::_GP('cookie_setting');
Email: COOKIE_SETTING t3lib_div::_GP('cookie_setting');

Form def: | Cookie_Setting=hidden | t3lib_div::_GP($cookie_setting);
Email: COOKIE_SETTING t3lib_div::_GP($cookie_setting);

I also tried variations (leaving off the ending semicolom, using the GET
or POST instead of the GP etc.) but my result is always what I literally
typed in that area of the form definition.  

What do I need to do to get the value stored in $cookie_setting (either
'Cookies are accepted' or 'Cookies are not accepted') sent in the email,
for example:
COOKIE_SETTING Cookies are not accepted

Is this possible?  I'm guessing I'm missing something obvious?

- jody



More information about the TYPO3-english mailing list