Lab 1

Lab Exercise: 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 course web directory (~/public_html/csc6341) from /shared/csc6341.
        cp /shared/csc6341/sample_form.html ~/public_html/csc6341
        cp /shared/csc6341/process.php ~/public_html/csc6341
    
    (2) Open sample_form.html from your home page: http://cscdevprod03.txwes.edu/~yourusername/csc6341/sample_form.html. 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 php code to make sure the data is submitted and captured.
  2. MySQL Database Connection
    (1) cp /shared/csc6341/pdo.php ~/public_html/csc6341
    (2) Change database connection info to your database and modify the query in pdo.php to display the table data rows in the supplier table s.
    (3) Open pdo.php from your home page: http://cscdevprod03.txwes.edu/~yourusername/csc6341/pdo.php. 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: