using a href (html)tag along with PHP
- by dexter
i have tried:
<?php include("delete.php") ?>
<?php
....
....
....
if($result=mysql_query($sql))
{
echo "<table><th>Id</th><th>Name</th><th>Description</th><th>Unit Price</th>";
while($row = mysql_fetch_array($result))
{
echo "<tr><td>".$row['Id']."</td><td>".$row['Name']."</td><td>".$row['Description']."</td><td>".$row['UnitPrice']."</td>
<td><a href='delproduct($row[Id])' onclick = 'return MsgOkCancel()'>Delete</a></td></tr>";
echo "<br/>";
}
}
?>
following javascript is in the same page:
<script type="text/javascript" language="javascript">
function MsgOkCancel() {
if (confirm("Are You Sure You Want to Delete?"))
{ return true }
else
{return false}
}
</script>
where delproduct is a javascript function in delete.php
written like:
<script type="javascript">
function delproduct(Id)
{
alert('Id '+ Id);
}
<script>
** after ** clicking Delete a okcancel message-box appear asking conformation
** but ** after clicking 'ok' it should execute statements inside delproduct function but it doesn't
it gives error like:
Object Not Found :The requested URL was not found on this server.
what would be the problem?
pls help,
thanks