I want to delete this row from datebase without redirect and forms.. Any .. I do not w开发者_如何学运维ant to use java .. I want to work only.. I will refresh page manually
its true or not ?
function delete() {
mysql_query("SELECT * FROM wtable");
mysql_query("DELETE FROM `s2010_wdb`.`wtable` WHERE `id`='".$poste['id']."'");
}
<form>
<h1>POST TITLE</h1><input type="submit" name="delete" value="title"></a>
</form>
You can't run PHP code in a web browser, so to do this without a form or a redirect, you must use AJAX to make an HTTP request to the server, where the delete will occur.
Not clear about your question but if you want to delete something from database after click the submit button then you can write code in the following way.
<form action="submitURL.php" method="get">
<input type="hidden" name="inputid" value="id1" />
<input type="hidden" name="actionname" value="delete" />
<input type="submit" name="delete" value="title">
</form>
submitURL.php will be like:
<?php
if($_GET["actionname"]=="delete"){
mysql_query("DELETE FROM `s2010_wdb`.`wtable` WHERE `id`='".$poste['id']."'");
}
?>
if you want to stay in the same page where you are just put the same file name in "action" or you can use PHP_SELF
精彩评论