i am trying to submit a form in javascript,
and then process it in php. and it will not work. can you please help? this is the code:
<?php
if ($_POST['markcomplete']=='yes'){
$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";
}
}
while($row=mysql_fetch_array($result)){
if($color==1){
?>
<form name='markcomplete' method=post>
<input type='hidden' value=yes name=markcomplete>
<input type='hidden' value=<?php echo $row['id']; ?> name='taskid' id='taskid'>
<td style='width: 200px;text-align: left; padding-left: 20px;'><?php if ($row['status']=='1'){ echo"<a href='javascript: document.markcomplete.submit();' class='task'> Mark complete</a>"; }else{ echo"Complete!"; } ?></td><td>
</form>
<?php
$color="2";
}else {
?>
<form name='markcomplete' method=post>
<input type='hidden' value=yes name=markcomplete>
<input type='hidden' value=<?php echo $row['id']; ?> name='taskid' id='taskid'>
<td style='text-align: left; padding-left: 20px;'><a href='javascript: document.markcomplete.submit();' class='task'>Mark complete</a></td><td style='width: 30px;'>
</forM>
<?php
$color="1";
}
}
?>
i think there is something wrong with the javascript, but im not sure. please help