Jump to content

DELETE/HIDE Function?


fuyuchi

Recommended Posts

Hii, I am having some trouble trying to create a Delete Record webpage.

 

What I want is a sort of button created which when being clicked on will hides the selected record from the user. That means the record the user wanted to "deleted" will be hidden from them but still shows up in the database.

 

The only workable codes I have are the basic delete function of php and it deletes the records from the database which I do not wish for it to happen.

 

I will appreciate any help. Sorry if my english sucks. (^^|||)

 

Search for a module to delete.

<html>
<head>
<title>Delete Module</title>
</head>
<body>  
  
  <form action="testDelete.php" method="post"> 
    <table> 
      <tbody>
        <tr> 
          <td>Enter Module Code:</td> 
          <td><input type="text" name="delete" /></td> 
        </tr> 
        <tr> 
          <td> 
            <p><input type="submit" value="Delete Modules" /></p> 			
		</td>

</body>
</html>

 

The deleted page.

<head>
<SCRIPT LANGUAGE="JavaScript">
function goToURL1() { window.location = "index.php"; }
</SCRIPT>
</head>

<?php

$mysqluser = "user1"; ///change to your userid
$mysqlpass = "12345"; /// change to your password
$mysqldb = "ModuleDatabase"; /// change to your database name

$delete= $_POST['delete'];

mysql_connect(localhost,$mysqluser,$mysqlpass);
@mysql_select_db($mysqldb) or die( "Unable to select database");

mysql_query("DELETE FROM modules WHERE code='$delete'"); 

mysql_close();
echo"Module deleted";

echo"<FORM><INPUT TYPE=\"button\" VALUE=\"Back\" onClick=\"history.go(-1);return true;\"> </FORM>";

?>
<input type=button value=" HOME " onClick="goToURL1()">

Link to comment
https://forums.phpfreaks.com/topic/189125-deletehide-function/
Share on other sites

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.