[PHP] Cookies not being read - begging php 4 chapter 8 pg 283
I am working through the beginning php 4 book by wrox and I can not get the example to work. It is reading and passing the form data but the cookies is not being written or read here is my code. Also why can I not place these variables in line with the echo statement. If I do it doesn't work. I thought I could just echo "face=$_POST['type_sel'] " <- but it does not work. if ( $_POST['type_sel'] ) echo "face=" . $_POST['type_sel'] . " "; if ( $_POST['size_sel'] ) echo "size=" . $_POST['size_sel'] . " "; Paul Kraus Code Testing Cookies Testing Cookies PHP What font type would you like to use? default $var"); ?> What font size would you like to use? default $var" ); ?> Your cookies say: " ); echo ( "\$font['type'] = $font['type']" ); echo ( "\$font['size'] = $font['size']" ); echo ( "" ); ?> Your form variables say: " ); echo "type_sel = " . $_POST['type_sel'] . ""; echo "size_sel = " . $_POST['size_sel'] . ""; echo ( "" ); ?> mailto:[EMAIL PROTECTED]"> Last modified: Thu Apr 03 21:58:00 Eastern Standard Time 2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cookies not being read - begging php 4 chapter 8 pg 283
Also when I first run this at the top I get this error... Notice: Undefined index: typeset in c:\inetpub\wwwroot\testing\cookies.php on line 4 Notice: Undefined index: size_sel in c:\inetpub\wwwroot\testing\cookies.php on line 5 I assume its because the var have not been filled but I still need the lines there do I need to turn of warnings or something? Paul -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 9:42 AM To: [EMAIL PROTECTED] Subject: [PHP] Cookies not being read - begging php 4 chapter 8 pg 283 I am working through the beginning php 4 book by wrox and I can not get the example to work. It is reading and passing the form data but the cookies is not being written or read here is my code. Also why can I not place these variables in line with the echo statement. If I do it doesn't work. I thought I could just echo "face=$_POST['type_sel'] " <- but it does not work. if ( $_POST['type_sel'] ) echo "face=" . $_POST['type_sel'] . " "; if ( $_POST['size_sel'] ) echo "size=" . $_POST['size_sel'] . " "; Paul Kraus Code Testing Cookies Testing Cookies PHP What font type would you like to use? default $var"); ?> What font size would you like to use? default $var" ); ?> Your cookies say: " ); echo ( "\$font['type'] = $font['type']" ); echo ( "\$font['size'] = $font['size']" ); echo ( "" ); ?> Your form variables say: " ); echo "type_sel = " . $_POST['type_sel'] . ""; echo "size_sel = " . $_POST['size_sel'] . ""; echo ( "" ); ?> mailto:[EMAIL PROTECTED]"> Last modified: Thu Apr 03 21:58:00 Eastern Standard Time 2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Cookies not being read - begging php 4 chapter 8 pg 283
Long... I have included everything in an attempt not to leave anything out. I think this book is dated and causing me some issues. Following is data before and after form data My source Code The php generated source code. Paul Kraus I have made the changes. Here is my output before any form data is sent. Before form data - Notice: Undefined index: type_sel in c:\inetpub\wwwroot\testing\cookies.php on line 4 Notice: Undefined index: size_sel in c:\inetpub\wwwroot\testing\cookies.php on line 5 Testing Cookies PHP What font type would you like to use? What font size would you like to use? Your cookies say: font Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 46 type= Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 47 Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 48 >bugger Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 50 $font['type'] = Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 51 $font['size'] = Your form variables say: Notice: Use of undefined constant type_sel - assumed 'type_sel' in c:\inetpub\wwwroot\testing\cookies.php on line 58 Notice: Undefined index: type_sel in c:\inetpub\wwwroot\testing\cookies.php on line 58 Notice: Use of undefined constant size_sel - assumed 'size_sel' in c:\inetpub\wwwroot\testing\cookies.php on line 59 Notice: Undefined index: size_sel in c:\inetpub\wwwroot\testing\cookies.php on line 59 > Notice: Undefined index: 'type_sel' in c:\inetpub\wwwroot\testing\cookies.php on line 61 $_POST['type_sel'] = Notice: Undefined index: 'size_sel' in c:\inetpub\wwwroot\testing\cookies.php on line 62 $_POST['size_sel'] = Last modified: Thu Apr 03 21:58:00 Eastern Standard Time 2003 After Form data --- Testing Cookies PHP - Beginning PHP4 Ch8 pg 283 What font type would you like to use? What font size would you like to use? Your cookies say: Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 40 type=> Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 44 $font['type'] = Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 45 $font['size'] = Your form variables say: type_sel = sans-serif size_sel = 2 Last modified: Thu Apr 03 21:58:00 Eastern Standard Time 2003 Code - Testing Cookies Testing Cookies PHP - Beginning PHP4 Ch8 pg 283 What font type would you like to use? default $var"); ?> What font size would you like to use? default $var" ); ?> Your cookies say: " ); echo ( "\$font['type'] = {$font['type']}" ); echo ( "\$font['size'] = {$font['size']}" ); echo ( "" ); ?> Your form variables say: " ); echo "type_sel = {$_POST['type_sel']}"; echo "size_sel = {$_POST['size_sel']}"; echo ( "" ); ?> mailto:[EMAIL PROTECTED]"> Last modified: Thu Apr 03 21:58:00 Eastern Standard Time 2003 Php Generated Source Notice: Undefined index: type_sel in c:\inetpub\wwwroot\testing\cookies.php on line 4 Notice: Undefined index: size_sel in c:\inetpub\wwwroot\testing\cookies.php on line 5 Testing Cookies Testing Cookies PHP What font type would you like to use? default arialhelveticasans-serifcourier What font size would you like to use? default 1234 567 Your cookies say: font Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 46 type= Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 47 Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 48 >bugger Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 50 $font['type'] = Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 51 $font['size'] = Your form variables say: Notice: Use of undefined constant type_sel - assumed 'type_sel' in c:\inetpub\wwwroot\testing\cookies.php on line 58 Notice: Undefined index: type_sel in c:\inetpub\wwwroot\testing\cookies.php on line 58 Notice: Use of undefined constant size_sel - assumed 'size_sel' in c:\inetpub
RE: [PHP] Cookies not being read - begging php 4 chapter 8 pg 283
Ok I fixed this by adding this line to the top of my script. $font=$HTTP_COOKIE_VARS['font']; Then everything worked great. I tried to access them like this $HTTP_COOKIE_VARS[font['type']] but this would not work. Is my syntax wrong are must you always set the http_cookie to a variable if it's an array? This book does not mention HTTP_COOKIE_VARS at all. Nor did it mention $_POST or $_GET. Am I doing something wrong with my script do I need to change something? Is there a new way to do $HTTP_COOKIE_VARS like there is for POST and GET? -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED] Sent: Friday, April 04, 2003 10:29 AM To: 'Ford, Mike [LSS]'; [EMAIL PROTECTED] Subject: RE: [PHP] Cookies not being read - begging php 4 chapter 8 pg 283 Long... I have included everything in an attempt not to leave anything out. I think this book is dated and causing me some issues. Following is data before and after form data My source Code The php generated source code. Paul Kraus I have made the changes. Here is my output before any form data is sent. Before form data - Notice: Undefined index: type_sel in c:\inetpub\wwwroot\testing\cookies.php on line 4 Notice: Undefined index: size_sel in c:\inetpub\wwwroot\testing\cookies.php on line 5 Testing Cookies PHP What font type would you like to use? What font size would you like to use? Your cookies say: font Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 46 type= Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 47 Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 48 >bugger Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 50 $font['type'] = Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 51 $font['size'] = Your form variables say: Notice: Use of undefined constant type_sel - assumed 'type_sel' in c:\inetpub\wwwroot\testing\cookies.php on line 58 Notice: Undefined index: type_sel in c:\inetpub\wwwroot\testing\cookies.php on line 58 Notice: Use of undefined constant size_sel - assumed 'size_sel' in c:\inetpub\wwwroot\testing\cookies.php on line 59 Notice: Undefined index: size_sel in c:\inetpub\wwwroot\testing\cookies.php on line 59 > Notice: Undefined index: 'type_sel' in c:\inetpub\wwwroot\testing\cookies.php on line 61 $_POST['type_sel'] = Notice: Undefined index: 'size_sel' in c:\inetpub\wwwroot\testing\cookies.php on line 62 $_POST['size_sel'] = Last modified: Thu Apr 03 21:58:00 Eastern Standard Time 2003 After Form data --- Testing Cookies PHP - Beginning PHP4 Ch8 pg 283 What font type would you like to use? What font size would you like to use? Your cookies say: Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 40 type=> Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 44 $font['type'] = Notice: Undefined variable: font in c:\inetpub\wwwroot\testing\cookies.php on line 45 $font['size'] = Your form variables say: type_sel = sans-serif size_sel = 2 Last modified: Thu Apr 03 21:58:00 Eastern Standard Time 2003 Code - Testing Cookies Testing Cookies PHP - Beginning PHP4 Ch8 pg 283 What font type would you like to use? default $var"); ?> What font size would you like to use? default $var" ); ?> Your cookies say: " ); echo ( "\$font['type'] = {$font['type']}" ); echo ( "\$font['size'] = {$font['size']}" ); echo ( "" ); ?> Your form variables say: " ); echo "type_sel = {$_POST['type_sel']}"; echo "size_sel = {$_POST['size_sel']}"; echo ( "" ); ?> mailto:[EMAIL PROTECTED]"> Last modified: Thu Apr 03 21:58:00 Eastern Standard Time 2003 Php Generated Source Notice: Undefined index: type_sel in c:\inetpub\wwwroot\testing\cookies.php on line 4 Notice: Undefined index: size_sel in c:\inetpub\wwwroot\testing\cookies.php on line 5 Testing Cookies Testing Cookies PHP What font type would you like to use? default arialhelveticasans-serifcourier What font size would you like to use? default 1234 567 Your cookies say: font Notice: Undefined variable: font in c
[PHP] Permission issues with fopen on window xp pro.
I am working with chapter 10 in wrox Beginning php 4 book. I am running my test system on windows XP pro. I believe this error is due to a permissions setting. But when I look at the properties for the default web page read write and scripts are all checked. Error: Warning: fopen(./counter.dat) [function.fopen]: failed to create stream: Permission denied in c:\inetpub\wwwroot\testing\counter.php on line 21 Code Simple Counter Simple Counter mailto:[EMAIL PROTECTED]"> Last modified: Sun Apr 06 11:01:02 Eastern Standard Time 2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php