RE: [PHP-DB] Run SQL query when click on OK button of warning message
| From: | Emiliano Boragina | Date: | Sun, 27 Jul 2008 21:47:24 +0000 |
| Subject: | RE: [PHP-DB] Run SQL query when click on OK button of warning message | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-45164@lists.php.net to get a copy of this message | ||
Hi,
Why the if(answer){ is not in the tag <?php?
+ _
// Emiliano Boragina _
// Diseño & Comunicación //////////////////
+ _
// emiliano.boragina@gmail.com /
// 15 40 58 60 02 ///////////////////////////
+ _
_____
De: Nasreen Laghari [mailto:nasreen_laghari@yahoo.com]
Enviado el: domingo, 27 de julio de 2008 18:04
Para: php-db@lists.php.net
Asunto: [!! SPAM] [PHP-DB] Run SQL query when click on OK button of warning
message
Hi All,
I am printing a java script warning message. On pressing OK button, I want
to run an sql query. Below is the way I have tried but sql query is running
either press OK or Cancel button on warning message or even refresh the page
(F5). Also redirection, when press OK, also not working.
Am I using the right approach? Could any 1 please help me to sort this
problem.
Regards,
Nasreen
<tr><td>
<input type="button" onClick="var answer = confirm ('Are you sure you want
to delete this record!!')
if (answer)
{
<?php
$sqldel = "DELETE FROM artist where aid = '$id'";
mysql_query($sqldel) or die(mysql_error());
//header("Location: artist.php");
//window.location=" <http://www.yahoo.com/> http://www.yahoo.com/"
?>
}
else
{
window.location='index.php'
}" value="DELETE">
</td></tr>