Delete Record In php With alert message

Head part alert message –

<head>

function ConfirmDelete()
{
var x = confirm(“Are you sure you want to delete?”);
if (x)
return true;
else
return false;
}

</head>

Body Part Php + Html code –

<form name=”myform” action=”delete.php” method=”post”>
<table border=”0″ width=”80%”cellspacing=”2″ cellpadding=”2″ align=”center”>
<tr>
<td colspan=”3″ align=”right” style=”font-size:24px” height=”50px;”> <b>Delete Customer Bill Details</b>
</td>
</tr>
<tr>
<td>&nbsp;
</td>
</tr>
<?php
if(isset($_GET[‘id’]))
{
$id =$_GET[‘id’];
$query = “select * from billdetails where billno = ‘”.$id.”‘”;
$qu1 = mysql_query($query, $con);
while($res= mysql_fetch_array($qu1))
{
$billno = $res[“billno”];
$bdate = $res[“bdate”];
$pname = $res[“pname”];
$venue = $res[“venue”];
$mobile = $res[“mobile”];
$email = $res[“email”];
$servicedes = $res[“servicedes”];
$samount = $res[“samount”];
$ramount = $res[“ramount”];
$famount = $res[“famount”];
$otherser = $res[“otherser”];
$oamount = $res[“oamount”];
$rswords = $res[“rswords”];
$tamount = $res[“tamount”];
$servicetax = $res[“servicetax”];
$discount = $res[“discount”];
$gamount = $res[“gamount”];
}
}
?>
<tr>
<td align=”left” style=”font-size:16px”><b>Bill No.:</b><span class=”star”>*</span>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”billno” value=”<?php echo $billno; ?>” required />
</td>
<td align=”left” style=”font-size:16px”><b>Bill Date:</b><span class=”star”>*</span>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” id=”datepicker3″ name=”billdate” value=”<?php echo $bdate; ?>” required  />
</td>
</tr>
<tr>
<td align=”left” style=”font-size:16px”><b>Party Name:</b><span class=”star”>*</span>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”pname” value=”<?php echo $pname; ?>” required  />
</td>
<td align=”left” style=”font-size:16px”><b>Venue:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”venue” value=”<?php echo  $venue; ?>”  />
</td>
</tr>
<tr>
<td align=”left” style=”font-size:16px”><b>Mobile No.:</b><span class=”star”>*</span>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”mobileno” value=”<?php echo $mobile; ?>” required />
</td>
<td align=”left” style=”font-size:16px”><b>Email Id:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”email” value=”<?php echo $email; ?>”  />
</td>
</tr>
<tr>
<td align=”left” style=”font-size:16px”><b>Service Descriptions:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”sd” value=”<?php echo $servicedes; ?>”   style=”width:234px; height:61px;”/>
</td>
<td align=”left” style=”font-size:16px”><b>Amount:</b><span class=”star”>*</span>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”samount” value=”<?php echo $samount; ?>” required />
</td>
</tr>
<tr>
<td align=”left” style=”font-size:16px”><b>Room Rent Amount: </b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”ramount” value=”<?php echo $ramount; ?>”  />
</td>
<td align=”left” style=”font-size:16px”><b>Food Beverage Amount:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”famount” value=”<?php echo $famount; ?>”  />
</td>
</tr>

<tr>
<td align=”left” style=”font-size:16px”><b>Other Services:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”os” value=”<?php echo $otherser; ?>”  />
</td>
<td align=”left” style=”font-size:16px”><b>Amount:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”oamount” value=”<?php echo $oamount; ?>”  />
</td>
</tr>
<tr>
<td align=”left” style=”font-size:16px” rowspan=”4″><b> Rs. In words:<b>
</td>
<td align=”left” style=”font-size:16px” rowspan=”4″><input type=”text” name=”words” value=”<?php echo $rswords; ?>”   style=”width:234px; height:75px;” />    </td>
<td align=”left” style=”font-size:16px”><b>Total Amount:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”tamount”value=”<?php echo $tamount; ?>”  />
</td>
</tr>
<tr>
<td align=”left” style=”font-size:16px”><b>Service Tax:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”stax” value=”<?php echo $servicetax; ?>”  required />
</td>
</tr>
<tr>
<td align=”left” style=”font-size:16px”><b>Discount:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”discount” value=”<?php echo $discount; ?>” />
</td>
</tr>
<tr>
<td align=”left” style=”font-size:16px”><b>Grand Total:</b>
</td>
<td align=”left” style=”font-size:16px”><input type=”text” name=”gt” value=”<?php echo $gamount; ?>”  />
</td>

</tr>
<?php
if(isset($_POST[‘Delete’]))
{
if(x == true)
{
$cid = $_POST[‘billno’];
$Query = “delete from billdetails where billno ='”.$cid.”‘”;
$up = mysql_query($Query,$con);
if($up)
{?>

<?php
}
}
else
{ ?>

<?php }
}
?>
<tr>
<td align=”left” style=”font-size:16px” >
</td>
<td align=”left” style=”font-size:16px” colspan=”3″ height=”45px;”> <input type=”submit” name=”Delete” Onclick=”return ConfirmDelete();” value=”Delete”  /></td>
</tr>

</table>
</form>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s