Blogger templates

Pemrograman Web Dinamis

Tidak ada komentar
Menampilkan data keluarga sebanyak n inputan

Source Code

data.php

<?php

session_start();
$_SESSION['ALDI']=0;
header("location;index.php")


?>


index.php

<html>
<head>
<title>form index</title>
</head>

<tr><td><b><font face="Times new Rowman">Biodata</font></b></td></tr>
<form action="index.php" method="post">
    <input type="text" name="LISTIA" placeholder="Nama">
    <input type="text" name="DIMAS" placeholder="Alamat">
    <br><input type="submit" value="Simpan"></br>
</form>

<table>
    <tr><td>Nama</td><td>Alamat</td></tr>
    <?php

    session_start();

    if(isset($_POST['LISTIA'])){
    $_SESSION['LISTIA'][$_SESSION['ALDI']][0]=$_POST['LISTIA'];
    $_SESSION['DIMAS'][$_SESSION['ALDI']][1]=$_POST['DIMAS'];
    $_SESSION['ALDI']++;
    }

    for($i=1;$i<$_SESSION['ALDI'];$i++){
    echo "<tr><td>".$_SESSION['LISTIA'][$i][0]."</td>";
    echo "<td>".$_SESSION['DIMAS'][$i][1]."</td></tr>";
    }

    ?>
</table>
</html>



Output


Tidak ada komentar :

Posting Komentar