Firstly, your url construction is incorrect. It should be:
http://www.domain.com/delete.php?del=25
Then you can use del
via GET
to access the value:
$del_id = $_GET['del'];
$strSQL = "DELETE FROM records WHERE record_id = $del_id";
mysql_ is deprecated.
You should be using mysqli_ or (even better) PDO instead.
The above code is susceptible to whats known as mysql injection.
As a rule of thumb, never ever trust the data coming from the user. So what you're doing here is without exaggeration disastrous.
Example:
//GET value: dave
query = " SELECT username, password FROM users WHERE username=$name ";
//Translates to:
query = " SELECT username, password FROM users WHERE username='dave' ";
//malicious input
//GET value: 'OR'1
query = " SELECT username, password FROM users WHERE username=$name ";
//Translates to:
query = "SELECT username, password FROM users WHERE username=''OR'1' ";
The nasty thing here is, 1 evaluates to true thus returning all usernames and passwords in the users table!
mysqli_real_escape_string() to the rescue
Despite being a mouthful to say, this function provides a safeguard by escaping injection attempts with MySQL-friendly '\' quote.
So pumping all your GET/POST data through this function provides a layer of security.
$name = mysqli_real_escape_string($_POST['username'];
Now hopefully that makes sense. Despite rhapsodising mysqli_real_escape_string()
I would highly recommend (at some point) looking into using something a bit more sophisticated like PDO
instead.