Download presentation
Presentation is loading. Please wait.
Published byPenelope Posy Palmer Modified over 8 years ago
1
FORM VALUE PASSING
2
Include Include files are files that are interpreted as part of a program at runtime. Include files usually contain program code or HTML code, but they can also contain other information (such as JavaScript code). The include statement follows this syntax: include(‘/path/filename’);
3
Including HTML Code The following example includes the files top.php and bottom.php, which simply contain HTML code, in their respective positions within the program: <?php /* demonstrates use of include() with HTML code in include file */ include(‘top.php’); ?> Hello! <?php include(‘bottom.php’); ?>
4
For example, perhaps the file top.php looks like this: PHP By Example and bottom.php looks like this:
5
Including PHP Code Using include with PHP code is similar to using it with HTML code. However, ensure that your PHP code is enclosed in PHP tags in the include file. <?php /* demonstrates include with PHP code in include file */ include(‘config.php’); ?> Hello, !
6
Perhaps config.php contains something like this: <?php /* Configuration code */ $user_name = “John Smith”; ?>
8
Reading Variable Reading variable from Web browser have 2 type: GET is basically for just getting (retrieving) data. the user agent takes the value of action, appends a ? to it, then appends the form data set, encoded using the application/x- www-form-urlencoded content type. The user agent then traverses the link to this URI. In this scenario, form data are restricted to ASCII codes. POST may involve anything, like storing or updating data, or ordering a product, or sending E-mail. the user agent conducts an HTTP post transaction using the value of the action attribute and a message created according to the content type specified by the enctype attribute.
9
For example(Textbox) /* form_ex.php */ //for GET //for POST login: password:
10
getPass.php <?php $login=$_GET['login']; $password=$_GET['password']; ?> Use GET Variable Your login = Your password =
11
postPass.php <?php $login=$_POST['login']; $password=$_POST['password']; ?> Use POST Variable Your login = Your password =
12
For example(Textarea) /* form_txt_area */ TEXTAREA /* txt_area.php */ <? $test=$_POST['textarea_test']; echo "textarea_test = ". $test; ?>
13
For example(Radio) /* form_radio.php*/ Select Sex Male Female /* radio_btt.php */ <? $sex=$_POST[sex']; echo " Radio_test = ". $sex; ?>
14
For example(List) /* form_list.php*/ 1-5 6-10 11-15 16-20 Over 21 /* listmenu.php */ <? $age=$_POST['select_old']; echo " List Menu_test = ". $ age; ?>
15
exercise Write programming with PHP language Input X,Y,Z from keyboard and display from monitor
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.