Good Evening earth....
I have a question here, can someone guide me with my question
Here it goes.
I have a html form, which calls the function in javascript and prompts the user whether to delete a specific user.The dialog box prompts but it is not sending the value that i require.
here is my code
<script type="text/javascript">
function ConfirmChoice()
{
answer = confirm("Do you really want to Delete?")
if (answer !="0")
{
location = "deleteuser.php"
}
}
</script>
<table>
<tr><td><input type="submit" name="exist" value="Add Staff" onclick="form.action='addstaff.php';"></td></tr>
<tr><td><select name="id">
<?php
//for each row we get from mysql, echo a form input
while ($row4 = mysql_fetch_array($result1)) {
echo "<option>$row4[ID]</option>\n";
}
?>
</select></td>
<td><input type="submit" name="exist" value="Delete Staff" onclick=" ConfirmChoice(); return false;"></td>
<td><input type="submit" name="exist" value="Edit Staff" onclick="form.action='editstaff.php';"></td></tr>
</tr>
</table>
//deleteuser.php
<?php
session_start();
require_once 'connection_details.php'; //Calling the Connection Detail php file
$tbl_name="employee"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$id=$_GET["id"];
$_SESSION['id']=$id;
$sql1=mysql_query("Delete FROM $tbl_name WHERE ID='$id'");
echo "<h1>User has been DELETED</h1>";
//header("refresh:1;url=displayemployee.php" );
?>
so, how i send the ID to deleteuser.php