Hi Guys,
I'm using this script:
<?php
// login stuff
include("../*****.php");
include("../*****.php");
# if form is submitted.....
if(isset($_POST['Submit'])) {
foreach($_POST['d'] as $value) {
mysql_query("insert into archive select * from news where news.newsid = '$value'; delete from news where news.newsid = '$value'");
}
}
# dont need this line unless you are using just one record
#if(isset($_GET['newsid']))
# query to get records.....
$result = mysql_query("select * from news",$link) or die(mysql_error());
if(mysql_error())
{
echo mysql_error() ."<br>\n";
}
?>
<body bgcolor="#FFFFFF">
<form name="form1" method="post" action="">
<table width="100%" cellpadding="1" cellspacing="1" bgcolor="#999999">
<tr bgcolor="#CCCCCC">
<td width="6%" valign="middle"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> </font><span class="brown_bold">No:</span></td>
<td width="94%" valign="middle" class="light_blue"><b class="blue_bold">News
Story:</b></td>
</tr>
<?php
#loop through the rocord
while($row = mysql_fetch_array($result, MYSQL_BOTH)){
?>
<tr bgcolor="#FFFFFF">
<td width="6%">
<input type="checkbox" name="d[]" value="<?php echo $row['newsid'];?>">
</td>
<td width="94%"><a href="news.php?newsid=<?php echo $row['newsid']?>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row['headline'];?></font></a></td>
</tr>
<?php
}?>
<tr bgcolor="#FFFFFF">
<td width="6%"> </td>
<td width="94%">
<input type="submit" name="Submit" value="Send to Archive" class="button">
</td>
</tr>
</table>
</form>
</body>
</html>
Which should output all 'headline' from my 'news' table and when I hit the checkbox next to it, and hit submit it then moves all of the information for that newsid from the 'news' table to the 'archive' table.
But it does not do anything upon submit - just return the same page and not move and delete the story - can anyone see where I am going wrong?
Thanks
Chris