[Typo3] cookies

christian oettinger christian.oettinger at gmx.de
Wed May 18 11:57:28 CEST 2005


Hi Jody,


Sorry for answering so late I've been away some days.
I don't know the solution to your problem, but I have two small advices:

First you could try if you find something about making your variable 
($cookie_setting) available for typo3. I guess this is the step you are 
missing in your php script. Look after "typo3 global variables" perhaps? 
After that you can read it at different places, in your case in the form 
script. Don't get me wrong: this is just a guess.

If you don't find it I would start a new thread with another name. I 
think your problem is not the cookies but to make a variable of your php 
script available for typo3/your form field. So maybe the people that 
could help don't read it. I thnk in this case it should be ok to rewrite 
your problem with new words.


sorry I can't be of any real help


oe (christian)



Jody Cleveland wrote:
> 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