Archive for May, 2007

Web hosting service - Figure 5-5 The SELECT element (also known as

Sunday, May 6th, 2007

Figure 5-5 The SELECT element (also known as list) allows you to display a fixed list of choices from which the user has to choose an element. The item selected won t be sent as displayed but will be sent as its value. In this example, the value and its display are identical, but in a database-driven system you would probably see record IDs as the values and their text label as list choices. A good example is a product number and its name. When using lists, be sure to set the value part of the OPTION items. If these are not set, the list looks the same but is totally useless because all choices will send the same null value. One Form, Multiple Processing Forms always react in a predefined way based on how you code your processing script to handle the data that the user sends to the system. A single form can have more than one defined action by using different submit buttons. 144 Chapter 5
Note: If you are looking for high quality webhost to host and run your jsp application check Vision jsp web hosting services

Figure 5-4 How It Works As you see, (Cheap web hosting)

Saturday, May 5th, 2007

Figure 5-4 How It Works As you see, this code uses logic similar to that in formprocess1.php. Two fields have been added (a drop-down list box and a checkbox). formprocess2.php does the same thing as formprocess1.php but with an added twist. It displays the debugging information only if the Debug checkbox is selected and greets you using any of the dropdown list choices in the subsections that follow. INPUT Checkbox Type The checkbox can represent only two possibilities: When checked, it passes the value on to the $_POST array, but otherwise it just doesn t send anything. This is a great way to represent Boolean typed data. * SELECT element

143 Form Elements: Letting the User Work with Data
Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision php5 hosting services

1 on 1 web hosting - Display Debug info 3. Create another empty file

Saturday, May 5th, 2007
Display Debug info

3. Create another empty file named formprocess2.php and enter the following code:

    


4. Save formprocess2.php and upload it to your work folder. 5. Call the page from your browser. As you can see from the resulting page, displayed in Figure 5-4, the form got a bit more complicated. 6. Enter your name and click the Submit button. The display page that appears, shown in Figure 5-5, is rather simple; it holds only debug information and a greeting. 142 Chapter 5
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services

Notice that the FORM element has an ending (Web hosting top)

Thursday, May 3rd, 2007

Notice that the FORM element has an ending tag and two attributes. The first attribute (action) is the recipient page address (the form processing script). The second attribute (method) is the way in which you will send the data to the recipient. There are two separate ways of sending a form to its processing script: the POST and the GET methods. The POST method (see Figure 5-3) takes the data from the form fields and sends it through an HTTP header. In this case, the data cannot be seen in the URL. Figure 5-3 The GET method gets the data from the form fields, encodes it, and adds it to the destination URL, as shown here: http://localhost/formprocess1.php?field1=valuea&field2=value%20b As you can see, the field names and their values are easy to read inside the script URL. Having the script parameters in the URL allows the user to change them manually. This can lead to errors in the script processing or access to data not originally meant to be accessed. INPUT Element The second new HTML element included here is INPUT. This is the basis of most forms and can be used in many different ways to gather many different types of information. In this case, you use two different types of INPUT: the text and submit types. Here s the INPUT TEXT type: The INPUT text type is a standard, single-line text box. As with all form controls, it needs a name so that the processing script can access its content using the following syntax: 139 Form Elements: Letting the User Work with Data
Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision php5 hosting services

Figure 5-2 (Free web servers) How It Works As with any

Thursday, May 3rd, 2007

Figure 5-2 How It Works As with any recipe, it s a good idea to start working on forms by understanding the ingredients. To familiarize yourself with forms, you ll need some background information about HTML form elements and a few new PHP functions. Let s start with the HTML form itself. You can find HTML references at the World Wide Web Consortium Web site at www.w3.org/MarkUp. FORM Element First, we ll introduce the first HTML element you ll need: FORM. It delimits the form area in the page and holds the fields you want your Web site users to fill in.

138 Chapter 5
Note: If you are looking for cheap and reliable webhost to host and run your web application check Vision coldfusion web hosting services

?> DEBUG : 4. Upload the files to

Wednesday, May 2nd, 2007

?>

  DEBUG :    

4. Upload the files to your Apache work directory. 5. Open form1.html in your browser. 6. Type test in the name text box (as shown in Figure 5-1) and click the Submit button. You can see two distinct parts on the resulting page: the Hello Test portion and the DEBUG part shown in Figure 5-2. You just coded your first form processing script. Figure 5-1 137 Form Elements: Letting the User Work with Data
Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision php5 hosting services

Web hosting comparison - Your First Form As a wise man once

Tuesday, May 1st, 2007

Your First Form As a wise man once said, every journey starts with a single step. To start this particular journey, you will focus on a very simple form. It will include only a text field and a submit button in a table layout. The processing script will display only the value entered in the text field. Try It Out Say My Name In this exercise, you are going to get PHP to respond to a name entered in a form. This is a simple variation of the typical hello world program, allowing you to take your first step into interactivity. 1. Create a text file named form1.html and open it in your favorite text editor. 2. Enter the following code:

Name

3. Create another empty file named formprocess1.php and enter the following code: Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web design programs services