Jump to content

[SOLVED] Delete doesnt execute whats wrong??


chokies12

Recommended Posts

here's my code i doesnt delete anything from the database

 

<html>
<head>
<title>Select</title>
</head>
<body>

<form name="form1" method="post" action="select.php">
  <table width="537" border="0">
    <tr>
      <th width="1" scope="row"> </th>
      <td width="126"> </td>
      <td width="300"> </td>
      <td width="92"> </td>
    </tr>
    <tr>
      <th scope="row"> </th>
      <td>Enter Lastname: </td>
      <td><label>
        <input name="keyword" type="text" id="keyword" size="50">
      </label></td>
      <td><input name="submit" type="submit" id="submit" value="Search"></td>
    </tr>
    <tr>
      <th scope="row"> </th>
      <td> </td>
      <td><label></label></td>
      <td> </td>
    </tr>
  </table>


</form>

<table border="1">
<div align="center"></div>
<tr>
<th>LastName</th>
<th>FirstName</th>
<th>MiddleName</th>
<th>Action</th>
</tr>

</body>
</html>

<?php
include('inc/function.php');
extract($_POST);


if(isset($submit)) {

//$keyword = strtolower($keyword);
$result = mysql_query("SELECT * FROM student_applicant_information WHERE ppd_lastname='$keyword'");
	if(mysql_num_rows($result)){

	while($rs = mysql_fetch_array($result)){
	$studID = $rs[0];
	$lastname = $rs[2];
	$firstname = $rs[3];
	$midname = $rs[4];

	echo "<tr>";
	echo "<td>$lastname</td>";
	echo "<td>$firstname</td>";
	echo "<td>$midname</td>";
	echo "<td><a href='select.php?a=delete&id=$studID'>Delete</a> <a href='select.php?a=edit&id$studID'>Edit</a></td>";
	echo "</tr>";

	}			
}

mysql_close($dbConn);
echo "</table>";
}

if($_GET['a'] == 'delete') {
$id = $_GET['id'];
$sql = "DELETE * FROM student_applicant_information WHERE stud_applicant_id=$id";
$result = mysql_query($sql);

}
if($_GET['a'] == 'eidt') {


echo "hello world";

}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.