Jump to content


Check out our Community Blogs

esial

Member Since 01 Sep 2012
Offline Last Active Sep 24 2012 09:20 PM
-----

Posts I've Made

In Topic: confirm delete

21 September 2012 - 12:37 AM

This is what i have done. i get the alert box but it does not delete my record. i guess i have to use javascript inside php to get the uid=id.
please help.




<html>
<head>
<script>
function confirmDelete(delUrl) {
if (confirm("Are you sure you want to delete")) {
document.location = delUrl;
}
}
</script>
</head>
<body bgcolor = "#497249">
<br />
<a href="del.php?uid=$id" onclick="return confirm('Are you sure you want to delete?')"></a>
<a href = "http://localhost:8080/www/log/admin/index.php" style= "color:white;"><center>ADD A RECORD</center></a>
<? //echo "successful"; ?>
<table border width="900" style="margin-left:auto;margin-right:auto">

<?php
//include("db.php");


$result=mysql_query("SELECT * FROM data");

while($test = mysql_fetch_array($result))
{

echo "&nbsp;&nbsp;&nbsp;";
$id = $test['uid'];
echo "<tr align='center'>";
echo"<tr><br /><th>ID</th><td><font color='white'><center>" .$test['uid']."</center></font></td></tr>";
echo"<tr><th>EMAIL ADDRESS</th><td><font color='white'><center>" .$test['email_address']."</center></font></td></tr>";
echo"<tr><th>BRAND</th></tr><td><font color='white'><center>". $test['brand']. "</center></font></td>";
echo"<tr><th>MODEL</th></tr><td><font color='white'><center>". $test['model']. "</center></font></td>";
echo"<tr><th>SERIAL NUMBER</th></tr><td><font color='white'><center>". $test['serial_no']. "</center></font></td>";
echo"<tr><th>DATE OF PURCHASE</th></tr><td><font color='white'><center>". $test['date_of_purchase']. "</center></font></td>";
echo"<tr><th>WARRANTY DATE</th></tr><td><font color='white'><center>". $test['warranty_date']. "</center></font></td>";
echo"<tr><th>SOFTWARE BRAND</th></tr><td><font color='white'><center>". $test['software_brand']. "</center></font></td>";
echo"<tr><th>SOFTWARE TYPE</th></tr><td><font color='white'><center>". $test['software_type']. "</center></font></td>";
echo"<tr><th>SOFTWARE VERSION</th></tr><td><font color='white'><center>". $test['software_version']. "</center></font></td>";
echo"<tr><th>LICENCE COPY</th></tr><td><font color='white'><center>". $test['licence_copy']. "</center></font></td>";
echo"<tr><th>LICENCE VALIDITY</th></tr><td><font color='white'><center>". $test['licence_validity']. "</center></font></td>";
echo"<tr><th>LICENCE EXPIRY DATE</th></tr><td><font color='white'><center>". $test['licence_expiry_date']. "</center></font></td>";
echo"<tr><th></th></tr><td><font color='white'><center>". $test['']. "</center></font><br /></td>";


echo "<td> <a href ='view.php?uid=$id'><font color='blue'><center>Edit</center></font></a>";

echo "<td> <a href ='del.php'><font color='red'><center>Delete</center></font></a>";

echo "</tr>";
		

}

mysql_close($conn);

?>

In Topic: confirm delete

20 September 2012 - 09:00 AM

it is on line 23

In Topic: confirm delete

19 September 2012 - 06:27 AM

thanks.php looks like


1
<?php



2      $result=mysql_query("SELECT * FROM data");

3      while($test = mysql_fetch_array($result))
4       {

5           echo "&nbsp;&nbsp;&nbsp;";
6           $id = $test['uid'];
7           echo "<tr align='center'>";
8           echo"<tr><br /><th>ID</th><td><font color='white'><center>" .$test['uid']."</center></font></td></tr>";
9            echo"<tr><th>EMAIL ADDRESS</th><td><font color='white'><center>" .$test['email_address']."</center></font>            </td></tr>";
10           echo"<tr><th>BRAND</th></tr><td><font color='white'><center>". $test['brand']. "</center></font></td>";
11            echo"<tr><th>MODEL</th></tr><td><font color='white'><center>". $test['model']. "</center></font></td>";
12            echo"<tr><th>SERIAL NUMBER</th></tr><td><font color='white'><center>". $test['serial_no']. "</center></font></td>";
13            echo"<tr><th>DATE OF PURCHASE</th></tr><td><font color='white'><center>". $test['date_of_purchase']. "          </center></font></td>";
14          echo"<tr><th>WARRANTY DATE</th></tr><td><font color='white'><center>". $test['warranty_date']. "</center></font></td>";
15            echo"<tr><th>SOFTWARE BRAND</th></tr><td><font color='white'><center>". $test['software_brand']. "</center></font></td>";
16              echo"<tr><th>SOFTWARE TYPE</th></tr><td><font color='white'><center>". $test['software_type']. "</center></font></td>";
17             echo"<tr><th>SOFTWARE VERSION</th></tr><td><font color='white'><center>". $test['software_version']. "</center></font></td>";
18                 echo"<tr><th>LICENCE COPY</th></tr><td><font color='white'><center>". $test['licence_copy']. "</center></font></td>";
19                echo"<tr><th>LICENCE VALIDITY</th></tr><td><font color='white'><center>". $test['licence_validity']. "</center></font></td>";
20                echo"<tr><th>LICENCE EXPIRY DATE</th></tr><td><font color='white'><center>". $test['licence_expiry_date']. "</center></font></td>";
21                  echo"<tr><th></th></tr><td><font color='white'><center>". $test['']. "</center></font><br /></td>";


22                   echo "<td><a href ='view.php?uid=$id'><font color='blue'><center>Edit</center></font></a>";

23                  echo "<td><a href ='del.php?uid=$id'><font color='red'><center>Delete</center></font></a>"

                   echo "</tr>";


}

mysql_close($conn);

?>

del.php looks like

<?php
$id =$_REQUEST['uid'];
mysql_query("DELETE FROM data WHERE uid = '$id'")
or die(mysql_error());
echo "<br />";
echo "The record was successfully deleted<br />";
?>

In Topic: confirm delete

19 September 2012 - 12:25 AM

how do i put this in php

<a href="javascript:confirmDelete('delete.page?id=1')">Delete</a>

I'm sorry but where exactly am i supposed to put that confirmdelete() function( either in thanks.php or del.php)


thank you,

In Topic: Refresh form after initial submission

17 September 2012 - 11:44 PM

sorry i posted in the wrong place.
I did the redirect using header(location:.........) it works perfect now.. I thought of using sessions, just to keep it more secure and more than that for the sake of knowledge.

Thank you,

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download