Yorkville High School Computer Science Department
Yorkville High School Computer Science Department on Facebook  Yorkville High School Computer Science Department Twitter Feed  Yorkville High School Computer Science Department on Instagram

Yorkville High School Computer Science

ASSIGNMENTS: No Current Assignments

Network Programming :: Projects :: Form Poster

Rubric
Lesson
Due: Database Error

Problem

Create a program that allows the user to enter their name as well as other information of your choice. The information should then be processed in a PHP file and the results sent back to the Java program to be displayed. You will need to follow these steps:

  1. Decide what name-value pairs you will send to the PHP file.
  2. Write the PHP file that will accept and process the request. You can check out this PHP lesson for basic details.
  3. Create a query string in your Java program that looks something like this:
    name1=value1&name2=value2
    Pass each name and value in the query string to the URLEncoder.encode() method before adding it to the query string.
  4. Open a URLConnection to the URL of the program that will accept the data.
  5. Set doOutput to true by calling the setDoOutput(true) mutator to use a POST request.
  6. Write the query string onto the URLConnection's OutputStream.
  7. Close the URLConnection's OutputStream.
  8. Read the server response from the URLConnection's InputStream.

To upload your PHP file you can follow the instructions in this HTML lesson.

Yorkville High School Computer Science Department on Facebook Yorkville High School Computer Science Department Twitter Feed Yorkville High School Computer Science Department on Instagram