Presentation is loading. Please wait.

Presentation is loading. Please wait.

PHP: Forms FdSc Module 109 Server side scripting and Database design

Similar presentations


Presentation on theme: "PHP: Forms FdSc Module 109 Server side scripting and Database design"— Presentation transcript:

1 PHP: Forms FdSc Module 109 Server side scripting and Database design
2011

2 Format From now on I will not be giving you complete worked examples
There will be “snippets” - Snippet is a programming term for a small region of re- usable source code (Wikipedia) It will be up to you to incorporate these into worked examples of your own

3 Input boxes Forename <INPUT TYPE='text' SIZE=20 MAXLENGTH=30 NAME='firstname'> Parameter Details TYPE Specifies the type of input control (Password – will blank input) SIZE Textbox size on form MAXLENGTH Number of characters allowed in the textbox NAME Input box name used to gather data

4 Radio buttons <INPUT TYPE='radio' NAME=‘sex' VALUE=male' CHECKED> > Parameter Details TYPE Specifies the type of input control VALUE Value returned if radio button is checked CHECKED Optional parameter – sets the default button NAME Input box name used to gather data

5 Radio buttons <form> <input type="radio" name="sex" value="male" /> Male<br /> <input type="radio" name="sex" value="female" /> Female </form> Radio buttons let a user select ONLY ONE of a limited number of choices Set each Radio Button to same name to group radio buttons Form tags must be used around each set of buttons, or else only one button on the whole page will be allowed to be set

6 Check boxes <INPUT TYPE='checkbox' NAME='course' VALUE='ITP L3' CHECKED> Parameter Details TYPE Specifies the type of input control VALUE Value returned if check box is ticked CHECKED Optional parameter – sets the default tick NAME Input box name used to gather data

7 Check boxes <form> <input type="checkbox" name=“genre" value=“fiction" /> Fiction <br /> <input type="checkbox" name=“genre" value=“biography" /> Biography </form> Check boxes let a user select ONE or MORE of a limited number of choices Set each check box to the same name to group them

8 Select boxes <SELECT NAME='names' MULTIPLE> <OPTION VALUE='' SELECTED> Mike Jones</OPTION> <OPTION VALUE=''> Tom White</OPTION> </SELECT> Parameter Details NAME Input box name used to gather data SIZE Number of items initially shown SELECTED Default selection on load OPTION An item in the list MULTIPLE Allows selection of more than one option VALUE Data used when item selected

9 Select boxes <SELECT NAME="Residence" SIZE="1"> <OPTION SELECTED>Flat <OPTION>End terrace <OPTION>Terraced <OPTION>Semi <OPTION>Detached </SELECT> <SELECT NAME=“Laptop" MULTIPLE SIZE="4"> <OPTION SELECTED>Dual core <OPTION>Hard drive <OPTION SELECTED>SSD <OPTION>BlueRay <OPTION>LED backlight <OPTION SELECTED>USB 3.0 </SELECT>

10 Text box <TEXTAREA NAME="Comments" ROWS="6" COLS="50">Add your comments here please</TEXTAREA> Parameter Details NAME Input box name used to gather data OPTIONAL TEXT Appears inside the box ROWS Number of visible rows in the box. Exceeding this amount introduces a vertical scroll bar. COLS Number of characters that can be typed before a new line is begun

11 Clear form Clears the form entries
<INPUT TYPE='reset' VALUE='Clear form'> If a value is not specified, the default is “Reset”

12 Submitting a form All forms need a submit button to send the data to the server <INPUT TYPE='submit' VALUE='Place order'> If a value is not specified, the default is “Submit”

13 Classroom example Create a form using all the data types described
The form can be one you will use in your project (create a ticket maybe) Echo the submitted data back to the client Position the returned data in a table Add the date (using PHP) in UK format Add a back button to return to the input page and a confirm button (to write data to MySQL) Demonstrate it working


Download ppt "PHP: Forms FdSc Module 109 Server side scripting and Database design"

Similar presentations


Ads by Google