15062024114854AM.pptx
Document Details
Uploaded by SafeNeodymium
Tags
Full Transcript
PHP DU #2305CS312 Unit-02 Form Processing and Session Management Prof. Vijay M Shekhat Computer Engineering Department Darshan Institute of Engineering & Technology, Rajkot [email protected]...
PHP DU #2305CS312 Unit-02 Form Processing and Session Management Prof. Vijay M Shekhat Computer Engineering Department Darshan Institute of Engineering & Technology, Rajkot [email protected] 9558045778 Looping Outline Form attributes Form processing Query string File handling File uploads Cleaning the received data Regular Expression Regular Expression functions Validation using Regular Expression Cookies in PHP Session in PHP Form Attributes Attribute Description accept-charset Specifies the character encodings used for form submission action Specifies where to send the form-data when a form is submitted autocomplete Specifies whether a form should have auto complete on or off enctype Specifies how the form-data should be encoded when submitting it to the server (available only when we use method=“POST") method Specifies the HTTP method to use when sending form-data (GET / POST) name Specifies the name of the form novalidate Specifies that the form should not be validated when submitted rel Specifies the relationship between a linked resource and the current document target Specifies where to display the response that is received after submitting the form #2305CS312 (PHP) Unit 02 – Form Processing and Session Prof. Vijay M Shekhat 3 Form Processing We can access form data using inbuilt PHP associative array. $_GET => in case we have used get method in the form $_POST => in case we have used post method in the form $_REQUEST => in both the cases For example, html recive.php html recive.php #2305CS312 (PHP) Unit 02 – Form Processing and Session Prof. Vijay M Shekhat 4 Query string Consider we have a URL: http://www.darshan.ac.in/course.php? id=4&name=BCA Here the query string is: ?id=4&name=BCA Here the query consists of two parts: a key id with value 4, and a key name with value BCA. php You can access the value of the query string keys using this code: