1.
Software:
·
WampServer 2.2
·
Apache 2.2.21
·
PHP 5.3.10
2.
Buat file: input.php
Ketik script berikut:
<?php
error_reporting(E_ALL
^ (E_NOTICE | E_WARNING));
session_start ();
echo
"<pre><form action=input.php method=POST>";
echo
" NIM : <input type=text
name=nis><br>";
echo
" Nama : <input type=text
name=nama><br>";
echo
" Jurusan : <select
name=jurusan><option>SI<option>TI</select>";
for
($saya=0;$saya<10;$saya++) {
if
($_SESSION ['a'][$saya][0]=="") {
$_SESSION['a'][$saya][0]=$_POST['nis'];
$_SESSION['a'][$saya][1]=$_POST['nama'];
$_SESSION['a'][$saya][2]=$_POST['jurusan'];
break; }}
echo
" <p><input type=submit value=Simpan><input type=reset
value=Kosongkan>";
echo
"<p><a href=output.php>Hasil</a>";
//Sumber:
http://contoh-program-php.blogspot.com/. Nama File:
contoh-program-php-sederhana.html
?>
3.
Buat file: output.php
Ketik script berikut:
<?php
error_reporting(E_ALL ^
(E_NOTICE | E_WARNING));
session_start();
for
($i=0;$i<count($_SESSION['a']);$i++) {
if ($i==0) {
echo "<table border=0
bgcolor=blue>";
echo
"<tr><th>NIS<th>Nama <th>Jurusan";
echo
"<tr><td>".$_SESSION['a'][$i][0]."<td>".$_SESSION['a'][$i][1]."<td>".$_SESSION['a'][$i][2];
}
else { echo
"<tr><td>".$_SESSION['a'][$i][0]."<td>".$_SESSION['a'][$i][1]."<td>".$_SESSION['a'][$i][2];
}}
//Sumber:
http://contoh-program-php.blogspot.com/. Nama File: contoh-program-php-sederhana.html
?>
</table>
<a href=input.php>Isi Data Lagi</a>
4.
Buat file: output.php
Ketik script berikut:
<?php
session_start();
unset($_SESSION['a']);
//Sumber: Desrizal. http://blog.codingwear.com/panduanphp/index.html.
Nama File: session.html
?>
5.
Hasilnya:
***
Sumber: Desrizal.
http://blog.codingwear.com/panduanphp/index.html. Nama File: session.html
"Boleh Konsultasi Masuk Jurusan Sistem Informasi via IG atau Tiktok."
|
Tips Skripsi Program Studi Sistem Informasi |
|
No comments:
Post a Comment