Lab 1

Lab Exercises: Web Form Submission and MySQL Connection

Objective: Be familiar with web form submission and processing. Be able to connect to MySQL database using PHP programs.

  1. Web Form Submission: (1) Copy the sample web page files: sample_form.html and process.php to your web directory from /shared/csc4341. (2) Open sample_form.html from your home page: Test web form submission. Study source code of both files to understand how web form data is submitted to the web server and captured in the processing page. (3) Add a new textbox in the web form and corresponding code in process.php. (4) Test the newly added textbox and code. Put all together:
    cp /shared/csc4341/sample_form.html ~/public_html/csc4341
    cp /shared/csc4341/process.php ~/public_html/csc4341
  2. MySQL Database Connection
    (1) cp /shared/csc4341/pdo.php ~/public_html/csc4341 (2) Change database connection info to your database and modify the query in pdo.php. (3) Open pdo.php from your home page: Make sure your database table data are displayed on the web page correctly.
  3. Develop an online MySQL query form that accepts database queries from the user and display the results returned from database. A sample form is given below