Does the action in php have any special meaning for parameters? See the code

Source: Internet
Author: User
Does the action in php have any special meaning for parameters? See the code I am learning php 5 and set the error prompt to display:
The following code is available:



Graph (perimeter & Area) Calculator
Rectangle |
Triangle |
Circle




Echo $ _ GET ["action"];

?>


Run http: // localhost/xphp/tuxingjsq. php and click the rectangular triangle and circular link. no error message is displayed.



When I change the action in the link to another name, for example, name, an error message is displayed, such:




Graph (perimeter & Area) Calculator
Rectangle |
Triangle |
Circle




Echo $ _ GET ["name"];

?>


The following error message is displayed:
PHP Notice: undefined index xxx

Excuse me: is this action special? Or other reasons?


Reply to discussion (solution)

Action
The purpose is to reach the goal

Of course you can use other words, but the processing program also needs to make corresponding changes.

Only one name.

Why do I use action? no error occurs. if I use other words, it may be any character.
Error code PHP Notice: undefined index xxx

You can also use name to complete your error prompt.

The key is that action does not display errors. other names are incorrectly displayed. why?

You don't just need PHP Notice: undefined index xxx
You should provide the complete error message!

Isn't your php just an echo?

First

Echo $ _ GET ["action"];

?>
You need to obtain the value of index as action from the $ _ GET array. The $ _ GET array is generated by the php execution engine and is generated by the get parameter in your url, that is, the red part in the example:
Http://www.baidu.com? A = 1 & B = 1
The php execution engine generates two indexes, that is
$ _ GET ['A'] = 1;
$ _ GET ['B'] = 1;
What happens if you GET $ _ GET ['c?
The execution engine will tell you that you didn't give it to me if you cannot find c.

That is, if you pass the action, the php execution engine reports the following error: PHP Notice: undefined index action.

The above is incorrect.

That is, if you do not pass the action, the php execution engine reports the following error: PHP Notice: undefined index action.

There must be other places where the previous get action is used.

I tried it on another computer with php. The php on this computer has no notice-level prompt and no problem. I am still not very clear about the principles of php. In general, this problem has not been solved. Paste it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.