I am having problem with $_GET array. More precisely I’m retrieving data from mysql database and writing as output like this;
while ($reg_pins = mysqli_fetch_assoc($r)){
echo "<tr>";
echo "<td><span class='tmp_id'>" . $reg_pins['tmp_id'] . ")</span></td>";
echo "<td> </td>";
echo "<td><span class='tmp_id'>" . $reg_pins['rights'] . "</span></td>";
echo "<td> </td>";
echo "<td><span class='tmp_id'>" . $reg_pins['reg_pin'] . "</span></td>";
echo "<td> </td>";
echo "<td><a class='del_a' href='" . $_SERVER['PHP_SELF'] . "?delete=" . $reg_pins['tmp_id'] . "' >Delete Key</a></td>";
echo "</tr>";
}
(I didn’t write whole connection and other statements what is needed for retrieving data from database)
This is work perfectly, but I want to delete some of this data, so I can not write code to delete it.
I am interested in how I can manipulate with this situation (with $_GET method) to achieve my goal?
I’m not sure I understand your question, but apparently you’re asking how to send information to a php script when the user clicks on a link.
If that’s your question, then you have to use url parameters. They are codified as follows:
And so on and so on…
What you’re doing is adding parameters after the “?” and you separate them with the “&” sign. Values can have anything you want (numbers, strings, etc).
On your php script, you catch the values as follows:
Does that help you? Let me know if you have more questions.