Task 7 - Form Handling and Genering Dynamic Views


Review and run my file handling code samples to understand how to create forms with all input controls and receive the submitted values at server side. After that, do following:

1. Assume a form is submitted to handler.php script, write handler.php script such that it should display all parameter names and values. Also display whether parameters were submitted using get or post.

2. Make a from with option to attach up to 5 pictures. Write fileshandler.php script such that it should save all those files in filestore directory. Rename the file as <original name>-<random string>.<extension>
Make another script showpics.php, it should display all pics stored in filestore folder. Show delete link with each picture, when user click that link, delete that picture from filestore directory. Google php functions to traverse directory and remove file. (Do not copy paste the code, handler multiple files using a loop on $_FILES array).

3. Make show-update-form.php file that opens an update form. Assume, request contain user id as "id" parameter. Use below defined array to populate from input fields. I hope you can easily guess the input types and number of fields from below data. If request do not container id parameter, show error "id is required to show update form". Do it using Bootstrap.

$user = array(
    "BCS-SP14-50" => array("name" => "Arham", "age" => 20, "city" => "Lahore", "gender" => "male", "subjects" => array("OOP", "Web Technologies", "Big Data", "Machine Learning")),
    "BCS-SP14-70" => array("name" => "Suzu", "age" => 25, "city" => "Islamabad", "gender" => "female", "subjects" => array("Web Technologies", "Fine Arts")),
    "BCS-SP14-90" => array("name" => "Arslan", "age" => 30, "city" => "Karachi", "gender" => "male", "subjects" => array("Web Technologies", "Big Data", "Web Design")));

Comments