登录 | 注册 | FAQ
Anonymous

PHP lesson 11, 2nd example: handler.php doesn't work totally

+ 发表回复

2 篇帖子 分页: 1 / 1


PHP lesson 11, 2nd example: handler.php doesn't work totally

marcmir » 周五 2月 20, 2015 5:36 pm

Dear HTML.net people,
For lesson 11 (Passing Form Variables)I noticed the codes (for html/php and handler.php files) for the 2nd example doesn't work completely.

See the handler.php file... the CASE 'default' (clause below) will not be tested for any input.
default:
$strBackgroundColor = "rgb(255,255,255)";
break;


If you just inform a name (and no favorite color) and submit the data (what I would suppose could get the 'default' case clause on switch), the browser will return the error below:
Notice: Undefined index: favoritecolor in C:\xampp\htdocs\handler(2).php on line 5

The example on lesson - at URL http://html.net/tutorials/php/lesson11_ex2.php - works fine.
Could you check - and clarify - what is the difference, please?

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 11, 2nd example: handler.php doesn't work tot

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

it's a radio it always have some value :)
头像

XainPro

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


+ 发表回复

分页: 1 / 1