کد HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form action="ch4-9.php" method="POST">
how many friend do you have?
<input type="text" name="number" size="5">
<br>
<br>
<input type="submit" value="submite order">
<br>
</form>
</body>
</html>
این صفحه اول
---------- Post added at 06:40 PM ---------- Previous post was at 06:39 PM ----------
کد PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form method="POST" action="ch4-9-1.php">
<?php
$num = $_POST['number'];
for ($counter=0; $counter < $num ; $counter++)
{
$OffSet = $counter+1 ;
echo "<b> <br>pleas enter the name of friend number $OffSet<br>";
echo "<b> <input name = child[] type = text>";
}
?>
<br>
<br>
<input type="submit" value="submite order">
</form>
</body>
</html>
این صفحه دوم
---------- Post added at 06:40 PM ---------- Previous post was at 06:40 PM ----------
کد PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
$c= $_POST['child'];
echo "<b> your friend's names are:<br>";
foreach($c as $index)
{
echo "<b>".$index."<br>";
}
?>
</body>
</html>
اینم صفحه سوم