PHPCookbook Reading Notes & ndash; chapter 2 form

Source: Internet
Author: User
The content of this chapter can be said to be a continuation of the previous chapter, because forms are also the basis of web, but also an important part of web basics. This chapter focuses on the verification, file upload, and related security issues of various form elements in the form. $ _ SERVER [REQUEST_METHOD]: checks whether the request is GET or POST to verify whether the email address is

The content of this chapter can be said to be a continuation of the previous chapter, because forms are also the basis of web, but also an important part of web basics. This chapter focuses on the verification, file upload, and related security issues of various form elements in the form. $ _ SERVER ['request _ method']: checks whether the REQUEST is GET or POST to verify whether the email address is

The content of this chapter can be said to be a continuation of the previous chapter, because forms are also the basis of web, but also an important part of web basics. This chapter focuses on the verification, file upload, and related security issues of various form elements in the form.

$ _ SERVER ['request _ method']: checks whether the REQUEST is GET or POST.

Function used to verify whether the email address is valid:

 function is_valid_email_address($email){         $qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]';         $dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]';         $atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.             '\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+';         $quoted_pair = '\\x5c[\\x00-\\x7f]';         $domain_literal = "\\x5b($dtext|$quoted_pair)*\\x5d";         $quoted_string = "\\x22($qtext|$quoted_pair)*\\x22";         $domain_ref = $atom;         $sub_domain = "($domain_ref|$domain_literal)";         $word = "($atom|$quoted_string)";         $domain = "$sub_domain(\\x2e$sub_domain)*";         $local_part = "$word(\\x2e$word)*";         $addr_spec = "$local_part\\x40$domain";         return preg_match("!^$addr_spec$!", $email) ? 1 : 0; } if (is_valid_email_address('cal@example.com')) {    print 'cal@example.com is a valid e-mail address'; } else {    print 'cal@example.com is not a valid e-mail address'; }
Super variables in PHP

$ _ SERVER: SERVER and running environment information

$ _ GET: http get request variable

$ _ POST: POST variable, which is an array for multiple checkboxes

$ _ FILES: File Upload variable

$ _ REQUEST: An array containing GET, POST, and COOKIE

$ _ SESSION: Session variable

$ _ ENV: Environment Variable

$ _ COOKIE: cookie variable

The difference between htmlentities () and htmlspecialchars (): htmlspecialchars only converts (& '"<>) These 5 characters, while

Htmlentities converts all contents

PHP multi-choice processing code
 The Bronx Brooklyn Manhattan Queens Staten Island
 

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.