Re: [PHP] Cookies not being read - begging php 4 chapter 8 pg 283

2003-04-04 Thread Jason Wong
On Saturday 05 April 2003 01:13, Paul Kraus wrote:
> 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?

The syntax for accessing items in multi-dimensional arrays is:

  $HTTP_COOKIE_VARS['font']['type']

> 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?

$_COOKIE

THe book is out of date. RTFM for the latest info, also read the 
changelog/history to see what has changed since the version of PHP mentioned 
in your book was released.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The human mind ordinarily operates at only ten percent of its capacity
-- the rest is overhead for the operating system.
*/


-- 
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

2003-04-04 Thread Paul Kraus
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

RE: [PHP] Cookies not being read - begging php 4 chapter 8 pg 283

2003-04-04 Thread Paul Kraus
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\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\

RE: [PHP] Cookies not being read - begging php 4 chapter 8 pg 283

2003-04-04 Thread Ford, Mike [LSS]
> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]
> Sent: 04 April 2003 15:44
> 
> 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?

Use isset():

if (isset($_POST['type_sel'])) etc...

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
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

2003-04-04 Thread Ford, Mike [LSS]
> -Original Message-
> From: Paul Kraus [mailto:[EMAIL PROTECTED]
> Sent: 04 April 2003 15:42
> 
 
> 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.

Please read the manual at
http://www.php.net/manual/en/language.types.string.php#language.types.string
.parsing for *why* this doesn't work, but short answer is:


  if ( $_POST['type_sel'] ) echo "face={$_POST['type_sel']}";
  if ( $_POST['size_sel'] ) echo "size={$_POST['size_sel']}";

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

-- 
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

2003-04-04 Thread Paul Kraus
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