you've almost got it. remember not to mix client side & server side. php will do its bit first and then javascript will work on the client side.
<a href=javascript:deleteClient(<?php echo $client_id; ?>)>
<script language="javascript">
function shouldDelete() {
return confirm("Delete the selected client?");
}
function deleteClient(client_id) {
if (shouldDelete())
location = "http://....deleteClient.php?client_id=" + <?php echo $client_id; ?>;
}
</script>
when the page is sent out php will process the page. if $client_id in php equals 5 here is what the client browser will receive:
<a href=javascript:deleteClient(5)>
<script language="javascript">
function shouldDelete() {
return confirm("Delete the selected client?");
}
function deleteClient(client_id) {
if (shouldDelete())
location = "http://....deleteClient.php?client_id=" + 5;
}
</script>
when the user clicks the link javascript will be called. if shouldDelete() is true then the location will be sent to deleteClient.php?client_id=5. in the deleteClient.php page echoing $client_id will result in 5 (the row to be deleted).