Pertemuan #2 PWD
<?php
session_start ();
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form action="input.php" method="post" >
<input type="text" name="nama" placeholder="nama">
<input type="text" name="alamat" placeholder="alamat">
<input type="submit" value="simpan">
<input type=reset value=Bersih>
</form>
<?php
for($saya=0;$saya<10000;$saya++) {
if ($_SESSION ['a'][$saya][0]=="") {
$_SESSION['a'][$saya][0]=$_POST['nama'];
$_SESSION['a'][$saya][1]=$_POST['alamat'];
break; }
}
for ($i=0;$i<count($_SESSION['a']);$i++) {
if ($i==0) {
echo "<table border=0 ";
echo "<tr><th>Nama<th>Alamat<tr>";
echo "<tr><td>".$_SESSION['a'][$i][0]."<td>".$_SESSION['a'][$i][1];
}
else { echo "<tr><td>".$_SESSION['a'][$i][0]."<td>".$_SESSION['a'][$i][1];
}}
?>
</body>
</html>
Tidak ada komentar:
Posting Komentar