Presentation is loading. Please wait.

Presentation is loading. Please wait.

NMED 3850 A Advanced Online Design February 1, 2010 V. Mahadevan.

Similar presentations


Presentation on theme: "NMED 3850 A Advanced Online Design February 1, 2010 V. Mahadevan."— Presentation transcript:

1 NMED 3850 A Advanced Online Design February 1, 2010 V. Mahadevan

2 Some More Fundamentals  HTML user interfaces can consist of more than just text fields and buttons.  Various user interface components are:  Drop down menus.  Radio buttons.  Checkboxes.  Text areas.  You can encapsulate these components in your HTML forms (surround with tags) to make the input more intuitive and easier to understand.

3 Fundamentals (cont.)  Drop down menu: Eins Zwei Drei Vier Funf

4 Fundamentals (cont.)  Radio buttons: Zero One  Checkboxes: Eins: Zwei:

5 Fundamentals (cont.)  Text areas:  The values of the various UI components can be passed to a PHP script using the POST method, just like the content of the text fields we’ve used earlier.

6 PHP $_POST Processing  Remember the special array $_POST that captures the data from submitted HTML forms.  <?php $numbers = $_POST['numbers']; $binary = $_POST['binary']; $numbers2 = $_POST['numbers2']; $textarea = $_POST['tarea']; print $numbers; print " "; print $binary; print " "; print count($numbers2);

7 PHP $_POST Processing (cont.) print " "; foreach ($numbers2 as $item) { print $item; print " "; } print $textarea; print " "; ?>

8 PHP $_POST Processing (cont.)  You can also pass hidden form values to a PHP script from an HTML form:  HTML:   PHP:  $hiddendata = $_POST['hiddendata'];

9 PHP $_GET Processing  Sometimes you want to pass data to a PHP script without using a form.  For this, the GET method can be used instead of POST.  HTML:  PHP test  PHP:  $data1 = $_GET['somedata'];

10 Adding Style With PHP  Just like with HTML, when you generate HTML from within PHP you can attach a pre-existing CSS style sheet to it or use CSS styles in the HTML header.  HTML header with embedded style: print " "; print "body { background-color: green;}"; print " ";

11 Adding Style With PHP (cont.)  HTML header with an external stylesheet: print " ";  The stylesheet itself will contain only one line: body { background-color: green;}

12 Form Validation With PHP  Simple form validation can be done in PHP using by using “if” statements.  Example:  if ($_POST["last_name"]) == "") {  // print an error message }

13 Lab  Write PHP scripts that:  Generate an HTML user interface comprising various elements such as checkboxes, radio buttons, and drop down menus.  Perform form validation on the entered data.  Insert the data into a database table.  Retrieve and display the data from a database table. The final output must make use of a CSS style sheet.

14 References  http://www.w3schools.com http://www.w3schools.com


Download ppt "NMED 3850 A Advanced Online Design February 1, 2010 V. Mahadevan."

Similar presentations


Ads by Google