silahkan dicoba !!!!
<!DOCTYPE html>
<html>
<body>
<form action="index.php" method="post">
Banyak Input:<br>
<input type="text" name="firstname" value="">
<br>
<input type="submit" value="Submit" name="submit">
</form>
</body>
</html>
<?php
if(isset($_POST['submit'])){
$xc = $_POST['firstname'];
echo"<form method='post' action='index.php'>";
for ($x = 1; $x <= $xc; $x++) {
echo "The number is: $x.<input type='text' name='namax[$x]''><br>";
}
echo "<input type='submit' name='submitt' value=clik><br>";
echo"</form>";
}
if(isset($_POST['submitt'])){
echo "<h1>yang diinputan nama :</h1>";
$nm = $_POST['namax'];
foreach ($nm as $key => $val)
{
echo "$key : $val <br/>";
}
}
?>
Langganan:
Posting Komentar (Atom)
0 Response to "input foreach sesuai jumlah"
Posting Komentar