Oleh: Ahmad Ramadhani, S.Kom

Slides:



Advertisements
Similar presentations
Pemrograman Web Dasar Pertemuan 12 PHP Array. Indexed arrays - Arrays with numeric index Associative arrays - Arrays with named keys Multidimensional.
Advertisements

XAMPP: Cross – Apache, MySQL, Php, Perl + FileZilla, Tomcat NetBeans: IDE PHP Installation.
Outline o What is an array ? o Indexed array o Associative array o Multidimensional array.
04/09/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
PHP – Get & Post; Functions; and Arrays IS6116 – 07 th February 2011.
PHP Forms and User Input The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input.
INTERNET APPLICATION DEVELOPMENT For More visit:
PHP / MySQL. What is PHP? PHP is an acronym for "PHP Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed.
PHP Arrays. Outline o What is array in PHP ? o Numeric array o Associative array o Multidimensional array.
PHP - Introduction Week 5 Dr. Ken Cosh Introducing PHP 1.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Array & Foreach อาร์เรย์และคำสั่งวนลูป. Content 1. Definition and Usage 2. Syntax 3. print_r() Statement 4. For and Foreach 5. Array Functions.
Web Programming Language Week 5 Dr. Ken Cosh Introducing PHP 1.
Outline if...else...elseif Statements Switch Loops Functions Arrays Forms.
CHAPTER 7 Introduction to PHP5 Part II อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
 An array stores multiple values in one single variable.  Example: Output: I like Honda Civic, BMW and Toyota.
11 – Introduction to PHP(1) Informatics Department Parahyangan Catholic University.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
A pache M ySQL P hp Robert Mudge Reference:
Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this.
Doing Something with All that Data!. On Submit…the data from a form is sent to the.php file listed under action.
Web Systems & Technologies
Remote hosts and web servers
CGS 3066: Web Programming and Design Spring 2017
Session 2 Basics of PHP.
CHAPTER 5 SERVER SIDE SCRIPTING
Pemrograman WEB I Pertemuan 6.
Receiving form Variables
Arrays Array functions Practice
Pemrograman WEB I Pertemuan 4.
เอกสารประกอบการบรรยายรายวิชา Web Technology
PHP with HTML.
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
PHP: Inserting data FdSc Module 109 Server side scripting and
>> PHP: Arrays.
PHP Arrays Functions.
CHAPTER 5 SERVER SIDE SCRIPTING
Web Technologies PHP 5 Basic Language.
PHP Arrays By Justin Nelsen.
1 CHAPTER 10 ADVANCED PHP.
Passing variables between pages
PHP Hypertext Preprocessor
PHP loeng 2.
8th Semester, Batch 2008 Department of Computer Science SSUET.
PHP FORM HANDLING Post Method
How to get data from a form
Basic Contact Form user sends an
Introduction to Web programming
Basic PHP Lecture by Nutthapat Keawrattanapat
Ch. 3. PHP (이 강의 내용의 대부분 예들은 w3schools. com/php/default
Dr. John P. Abraham Professor UTRGV eCommerce CSCI 6314
Introduction to Web programming
>> PHP: Form-Variables & Submission
Software Engineering for Internet Applications
PHP Function.
PHP: Basics FdSc Module 109 Server side scripting and Database design
Class05 How to get data from a form
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Basics (Cont...).
Web Programming Language
محمد احمدی نیا PHP محمد احمدی نیا
Cookie and Session Bayu Priyambadha, S.Kom.
PHP an introduction.
PHP PROF. S. LAKSHMANAN, DEPT. OF B. VOC. (SD & SA),
PHP Lecture 11 Kanida Sinmai
PHP-II.
PHP Array.
Form Design & Validation
PHP By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and.
Presentation transcript:

Oleh: Ahmad Ramadhani, S.Kom PHP Array & Form Oleh: Ahmad Ramadhani, S.Kom

Array An array is a special variable, which can hold more than one value at a time. Contoh : $cars1="Volvo"; $cars2="BMW"; $cars3="Toyota"; Bisa diganti dengan : $cars=array("Volvo","BMW","Toyota");

Tipe Array In PHP, there are three types of arrays: Indexed arrays - Arrays with numeric index Associative arrays - Arrays with named keys Multidimensional arrays - Arrays containing one or more arrays

PHP Indexed Arrays The index can be assigned automatically (index always starts at 0): $cars=array("Volvo","BMW","Toyota"); or the index can be assigned manually: $cars[0]="Volvo"; $cars[1]="BMW"; $cars[2]="Toyota";

Cara memanggil isi array: < Cara memanggil isi array: <?php $cars=array("Volvo","BMW","Toyota"); echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . "."; ?> Cara menghitung isi array : <?php $cars=array("Volvo","BMW","Toyota"); echo count($cars); ?>

<?php $cars=array("Volvo","BMW","Toyota"); $arrlength=count($cars); for($x=0;$x<$arrlength;$x++)   {   echo $cars[$x];   echo "<br>";   } ?>

PHP Associative Arrays Associative arrays are arrays that use named keys that you assign to them. There are two ways to create an associative array:  $age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43"); or: $age['Peter']="35"; $age['Ben']="37"; $age['Joe']="43";

Cara memanggil : <?php $age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43"); echo "Peter is " . $age['Peter'] . " years old."; ?> Cara loop : <?php $age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43"); foreach($age as $x=>$x_value) { echo "Key=" . $x . ", Value=" . $x_value; echo "<br>"; } ?>

Form Cara mengirim : <html> <body> <form action="welcome.php" method="post"> Name: <input type="text" name="name"><br> E-mail: <input type="text" name="email"><br> <input type="submit"> </form> </body> </html> Cara memanggil: <html> <body> Welcome <?php echo $_POST["name"]; ?><br> Your email address is: <?php echo $_POST["email"]; ?> </body> </html>

Form Cara mengirim : <html> <body> <form action="welcome.php" method=“get"> Name: <input type="text" name="name"><br> E-mail: <input type="text" name="email"><br> <input type="submit"> </form> </body> </html> Cara memanggil: <html> <body> Welcome <?php echo $_GET["name"]; ?><br> Your email address is: <?php echo $_GET["email"]; ?> </body> </html>