登录 | 注册 | FAQ
Anonymous

PHP lesson 13 / Cookies: error in examples

+ 发表回复

2 篇帖子 分页: 1 / 1


PHP lesson 13 / Cookies: error in examples

marcmir » 周四 2月 26, 2015 9:06 pm

People of HTML.net,
The examples in 13th lesson are wrong or uncompleted. Please check the red texts below...

Consider the 2nd example as below (the closing-quote) and it will go fine.
<?php
// Setting the cookie
setcookie("Name", "C. Wing
", time()+3600);
setcookie("Interests", "plane spotting", time()+3600);
?>


Consider the 3rd example as below (right name for field 'Interests' - in plural - to agree with data set in 2nd example's cookie, the right position for closing-quote " and for '$' string mark) and it will work.
<?php
// Retrieve values from the cookie
$strName = $_COOKIE["Name"];
$strInterest = $_COOKIE["Interest
s"];

// Write to the client
echo "<p>" .
$strName . "</p>"
echo "<p>Your interest is
" . $strInterest . "</p>"
?>


The 5th example is also not working - I got the error 'Notice: Undefined index: HTMLTest in PHP_lesson13_5thExample.php on line 5(th - of example).'.

Can you check them and fix all?
Thanks.
头像

marcmir

  • 帖子: 10
  • 注册: 周日 3月 18, 2012 6:52 pm
  • 地址: Rio de Janeiro, RJ, Brazil
--
_______________________________________________________________
Before print, think in your responsibility with the environment

Re: PHP lesson 13 / Cookies: error in examples

XainPro » 周一 3月 02, 2015 9:02 pm

undefined is not error it's just a notice :)
but thanks for notice will check and update accordingly !
头像

XainPro

  • 帖子: 3933
  • 注册: 周五 2月 17, 2012 8:10 pm


+ 发表回复

分页: 1 / 1