I need to pass a variable to my other page through the URL bar. I have one error: Notice: Undefined index: $id in C:\xampp\htdocs\Kyle_Site\Programming Rite\controle\delete.php on line 3
I assume that I’m getting this error from not passing correctly, but I’m not sure any help is appreciated!
I’m passing the variable here:
<a href="delete.php?id=<?php echo $username['id'] ; ?>">Delete</a></td>
Here is where the variable supposed to be passed:
<?php
require 'core.inc.php';
$id = $_GET['$id'];
if (isset($_POST['delete'])) {
$answer = $_POST['decision'];
if ($answer == 'yes') {
echo 'user deleted'; }
}
echo '<h1>Are you sure you want to delete '.$id.'?</h1>
<form name ="form1" method ="POST" action ="delete.php">
<input type="radio" name="decision" value="yes">Yes
<input type="radio" name="decision" value="no">No
<input type="submit" name="delete" value="Delete">
</form>';
?>
Your get Variable is wrong. You should also check if the get variable is set.