After studying this chapter you will be able to understand: Super global variables, passing form data, passing data with sessions, regular expressions in PHP, validating user input at server, string functions. | 1 CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr. Tehseen Riaz Abbasi 1 2 3 3 Passing Form Data action method (POST or GET) When to Use GET? When to Use POST? Compare GET vs. POST Super Global Variables 4 Passing data with forms Passing Text Field Data Passing Hidden Field Data Getting Value From Checkbox Getting Value From Radio Button Getting Value From Select List Using session Variables 5 Regular expressions in PHP Validating user input at server String functions 6 6 Department of Computer Science, CIIT Islamabad. Regular expressions are sequence or pattern of characters itself. They provide the foundation for pattern-matching functionality A regular expression is a concise notation to describe patterns in strings Regular expressions provide the foundation for describing or matching data according to defined syntax rules Example: |^[0-9]{2}-[0-9]{2}-[0-9]{4}$| 7 Using regular expression you can search a particular string inside a another string, you can replace one string by another string and you can split a string into many chunks. PHP offers functions specific to two sets of regular expression functions, each corresponding to a certain type of regular expression. You can use any of them based on your comfort. POSIX Regular Expressions PERL Style Regular Expressions 8 |^[0-9]{2}-[0-9]{2}-[0-9]{4}$| 9 Start and end of RE Sub pattern Sub pattern Sub pattern Start matching from the start Match the end of the string Sub pattern with fixed character Allowed characters length [0-9] {2} 10 Brackets Brackets ([]) have a special meaning when used in the context of regular expressions. They are used to find a range of characters. [0-9] It matches any decimal digit from 0 through 9. Brackets: [a-Z], [A-Z], [a-z], [0-9] 11 Quantifiers The frequency or position of bracketed character sequences and single characters can be denoted by a special character. Each special character having a specific connotation. The +, *, ?, {int. range}, and $ flags all follow a character | 1 CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr. Tehseen Riaz Abbasi 1 2 3 3 Passing Form Data action method (POST or GET) When to Use GET? When to Use POST? Compare GET vs. POST Super Global Variables 4 Passing data with forms Passing Text Field Data Passing Hidden Field Data Getting Value From Checkbox Getting Value From Radio Button Getting Value From Select List Using session Variables 5 Regular expressions in PHP Validating user input at server String functions 6 6 Department of Computer Science, CIIT Islamabad. Regular expressions are sequence or pattern of characters itself. They provide the foundation for pattern-matching functionality A regular expression is a concise notation to describe patterns in strings Regular expressions provide the foundation for describing or matching data according to defined syntax rules Example: |^[0-9]{2}-[0-9]{2}-[0-9]{4}$| 7 Using regular expression you can search a particular string inside a another string, you can replace one string by