1 / 8

Forms

Forms. Lecture 5. Uses of Forms. Feedback Guestbook Survey e-commerce (i.e. selling). Processing Forms. You will need a special script (program) that is written in a specific programming language to process your form data.

dana
Télécharger la présentation

Forms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Forms Lecture 5

  2. Uses of Forms • Feedback • Guestbook • Survey • e-commerce (i.e. selling)

  3. Processing Forms • You will need a special script (program) that is written in a specific programming language to process your form data. • CGI which stands for Common Gateway Interface is an example of a script that is written in Pearl. • Each element on you form will have a name and value so that the name-value pair (visitor-name=Areej) will be sent to the server. • CGI will process data and return feedback.

  4. GET VS POST • There are two methods in which you can send form data to the server: • Get method: appends form data in the URL http://www.cookwood.com/cgi-bin/cgi.script?visitor_name=Areej&visitor_email=aa7097@yahoo.com&submit=Send+info • Post method: sends form data to the server in a data file (invisibly).

  5. Continued • The get method is less secure and is used for short forms. • The post method is more secure and is used for longer forms.

  6. Getting Scripts • You can create your own scripts or download them from the Internet then customize them. • Some servers require that cgi scripts be located in the cgi-bin directory. • After obtaining the script on your server you can add it to your form.

  7. Example

  8. HTML Code for Previous Form • <html> • <head> • <title>Creating Forms</title> • </head> • <body> • <h2>Ordering your new bed</h2> • <form method="post" action="http://www.cookwood.com/cgi-bin/display_results.pl"> • Name: <input type="text" name="name"> • Address: <input type="text" name="address" size="30"> • <p>City: <input type="text" name="city"> • State: <input type="text" name="state" size="2" maxlength="2"> • Zipcode: <input type="text" name="zip" size="5" maxlength="5"> • Customer Code: <input type="password" name="code" size="8"></p> • <hr> • <b>Type of wood:</b> <select name="woodtype" > • <option value="Mahogany">Mahogany</option> • <option value="Maplewood">Maplewood</option> • <option value="Pine">Pine</option> • <option value="Cherry">Cherry</option> • </select> • <b>Size:</b> <input type="radio" name="size" value="K">King • <input type="radio" name="size" value="Q">Queen • <input type="radio" name="size" value="T">Twin • <input type="radio" name="size" value="S">Single • <p><b>Extras:</b> • <input type="checkbox" name="extras" value="foot">Footboard • <input type="checkbox" name="extras" value="drawers" checked="checked">Drawers (for underneath) • <input type="checkbox" name="extras" value="casters">Casters • <input type="checkbox" name="extras" value="nosqueak" />Squeak proofing</p> • <hr>Please share any suggestions or comments with us: • <textareaname="comments" rows="3" cols="65">Comments?</textarea><hr> • <input type="submit" value="Order Bed"> • <input type="reset" value="Start Over"> • </form> • </body> • </html>

More Related