Page.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=utf-8" />
<title>Page 1</title>
</head>
<body>
<?php
if (isset($_POST['go'])){
echo "Date : " .$date = date('d-m-Y');
$number = $_POST['number'];
echo "<br/> Member : ".$number;
echo '<table border="1" align="center" cellpadding="5"><tr> <th>ID</th> <th>Name of Member</th> <th>Cell No</th> </tr>';
echo '<form name="addmember" method="post" action="script.php">';
for ($i=1; $i<=$number; $i++){
?>
<tr>
<td>Member (<?php echo $i ?>) </td>
<td><input type="text" name="name[]" value="" /></td>
<td><input type="text" name="cell[]" value="" /></td>
<input type="hidden" name="number" value="<?php echo $number; ?>" />
</tr>
<?php }
echo '<tr align="right"> <td colspan="3">';
echo '<input type="submit" name="submit" value="Save" />';
//echo '<input type="submit" name="back" value="Back" />';
echo '</td></tr>';
echo '</form>';
}
else{
?>
<form name="menber" method="post">
Number of Member : <input type="text" name="number" value="" />
<input type="submit" name="go" value="Go" />
</form>
<?php }
?>
</body>
</html>
Script.php
<?php
$host = 'localhost';
$username = 'root';
$password = '';
$database = 'test';
$con = mysql_connect($host, $username, $password) or die (mysql_error("Database connecton error !!"));
mysql_select_db($database, $con) or die (mysql_error("Database Selection error !!"));
$date = date('d-m-Y');
$total = $_POST['number'];
$name = $_POST['name'];
$cell = $_POST['cell'];
for ($i=0; $i<$total; $i++){
mysql_query ("insert into machmember values (null, '".$name[$i]."', '".$cell[$i]."', '".$date."')");
}
echo "Data insert succesfully !!";
?>
<!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=utf-8" />
<title>Page 1</title>
</head>
<body>
<?php
if (isset($_POST['go'])){
echo "Date : " .$date = date('d-m-Y');
$number = $_POST['number'];
echo "<br/> Member : ".$number;
echo '<table border="1" align="center" cellpadding="5"><tr> <th>ID</th> <th>Name of Member</th> <th>Cell No</th> </tr>';
echo '<form name="addmember" method="post" action="script.php">';
for ($i=1; $i<=$number; $i++){
?>
<tr>
<td>Member (<?php echo $i ?>) </td>
<td><input type="text" name="name[]" value="" /></td>
<td><input type="text" name="cell[]" value="" /></td>
<input type="hidden" name="number" value="<?php echo $number; ?>" />
</tr>
<?php }
echo '<tr align="right"> <td colspan="3">';
echo '<input type="submit" name="submit" value="Save" />';
//echo '<input type="submit" name="back" value="Back" />';
echo '</td></tr>';
echo '</form>';
}
else{
?>
<form name="menber" method="post">
Number of Member : <input type="text" name="number" value="" />
<input type="submit" name="go" value="Go" />
</form>
<?php }
?>
</body>
</html>
Script.php
<?php
$host = 'localhost';
$username = 'root';
$password = '';
$database = 'test';
$con = mysql_connect($host, $username, $password) or die (mysql_error("Database connecton error !!"));
mysql_select_db($database, $con) or die (mysql_error("Database Selection error !!"));
$date = date('d-m-Y');
$total = $_POST['number'];
$name = $_POST['name'];
$cell = $_POST['cell'];
for ($i=0; $i<$total; $i++){
mysql_query ("insert into machmember values (null, '".$name[$i]."', '".$cell[$i]."', '".$date."')");
}
echo "Data insert succesfully !!";
?>