0

i am using the following code to submit a form:

<script>
	function marktaskcomplete(){
	document.forms["markcomplete"].submit();
}
</script>
<?
		if ($_POST['markcompletevalue']=='yes'){
			include "dbconnect.php";
		$taskid=$_POST['taskid'];
		$query="UPDATE tasks SET status='0' WHERE uid='$id' AND id='$taskid'";
        $result=mysql_query($query);
		if ($result){
			echo "<script>location.href='?goto=taskmanager'</script>";
		}else{
			echo"fail";
		}
		mysql_close;
	}
	?>

and when i try to submit more then 1 form with it, it doesnt work. It will only work for the first.
can anyone help? thank you in advance

2
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by tcollins412
0
while($row=mysql_fetch_array($result)){
if($color==1){
?>
<form name='markcomplete' method=post>
<tr style='background-color:#ABD99B;'><td style='width: 200px; padding-left: 20px; font-weight: bold; font-family: arial; font-size: 10pt; text-align: left;'><a href='?goto=viewtask&id=<?php echo $row['id']; ?>' class='task'><?php echo $row['name']; ?></a></td><td style='width: 200px; font-size: 10pt;text-align: left; padding-left: 20px; vertical-align: center;'><?php
$text = $row['description'];
$text_array = explode(' ', $text);
for($x = 0; $x < 30; $x++){
echo $text_array[$x], " ";
}
?>
</td>
<input type='hidden' value=yes name=markcompletevalue>
<input type='hidden' value=<?php echo $row['id']; ?> name='taskid' id='taskid'>
<input type='hidden' value=<?php echo $id; ?> name='userid' id='userid'>
<td style='width: 200px;text-align: left; padding-left: 20px;'><?php if ($row['status']=='1'){ echo"<a href='javascript: marktaskcomplete();' class='task'> Mark complete</a>"; }else{ echo"Complete!"; } ?></td><td>
<?php  
	if($row['status']=='1' && date("dd-mm-yyyy")>$row['duedate']){ 
	echo"<img src='images/done.gif'>"; }
	else if ($row['status']=='1'){ echo"<img src='images/green.gif'>"; }
	else if($row['status']=='0'){ echo"<img src='images/checkmark.gif'>"; }
	?> </td></tr>
</FORM>
<?php
$color="2";
}else {
?>
<form name='markcomplete' method=post>
<tr style='background-color:#C7CFEB;'><td style='width: 200px; padding-left: 20px; fopnt-weight: bold; font-family: arial; font-size: 10pt; text-align: left;'><a href='?goto=viewtask&id=<?php echo $row['id']; ?>' class='task'><?php echo $row['name']; ?></a></td><td style='width: 200px; font-size: 10pt;text-align: left; padding-left: 20px; vertical-align: center;'><?php
$text = $row['description'];
$text_array = explode(' ', $text);
for($x = 0; $x < 30; $x++){
echo $text_array[$x], " ";
}
?>
</td>
<input type='hidden' value=yes name=markcompletevalue>
<input type='hidden' value=<?php echo $row['id']; ?> name='taskid' id='taskid'>
<input type='hidden' value=<?php echo $id; ?> name='userid' id='userid'>
<td style='width: 200px;text-align: left; padding-left: 20px;'><?php if ($row['status']=='1'){ echo"<a href='javascript: marktaskcomplete();' class='task'> Mark complete</a>"; }else{ echo"Complete!"; } ?></td><td>
<?php  
	if($row['status']=='1' && date("dd-mm-yyyy")>$row['duedate']){ 
	echo"<img src='images/done.gif'>"; }
	else if ($row['status']=='1'){ echo"<img src='images/green.gif'>"; }
	else if($row['status']=='0'){ echo"<img src='images/checkmark.gif'>"; }
	?> </td></tr>
</forM>
<?php
$color="1";
}
}
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.