Hi I'm not sure wher I am going wrong.
I've borrowed some code and tweaked it.
The database table consists of
id,dates,day,type,.
The form brings up the mutiple enteries to edit, but when the submit is pushed it refreshes with the original information. i've checked the databse and that remains unchanged.
I'd be greatful of some help.
Thanks
<?php
// Connect to server and select databse.
mysql_connect("localhost", "***", "***")or die("cannot connect");
mysql_select_db("***")or die("cannot select DB");
$sql="SELECT * FROM competition";
$result=mysql_query($sql);
// Count table rows
$count=mysql_num_rows($result);
echo $count."<br/>";
?>
<table width="500" border="0" cellspacing="1" cellpadding="0">
<form name="form1" method="post" action="">
<table width="500" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="center"><strong>Id</strong></td>
<td align="center"><strong>Date</strong></td>
<td align="center"><strong>Day</strong></td>
<td align="center"><strong>Type</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td align="center"><?php $id[]=$rows['id']; ?><?php echo $rows['id']; ?></td>
<td align="center"><input name="dates[]" type="text" value="<?php echo $rows['dates']; ?>"></td>
<td align="center"><input name="day[]" type="text" value="<?php echo $rows['day']; ?>"></td>
<td align="center"><input name="type[]" type="text" value="<?php echo $rows['type']; ?>"></td>
</tr>
<?php
}
?>
<tr>
<td colspan="4" align="center"><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</table>
<?php
// Check if button name "Submit" is active, do this
if($Submit){
for($i=0;$i<$count;$i++){
$sql1="UPDATE `competition` SET `dates`='$dates[$i]', `day`='$day[$i]', `type`='$type[$i]' WHERE `id`='$id[$i]'";
$result1=mysql_query($sql1);
}
}
if($result1){
header("location:update_multiple.php");
}
mysql_close();
?>
</html>