I am getting an error in my code where essentially my user input isn't being read and I'm not sure why. I used isset and it skips over, that means that the user input isn't being read in right? Any ideas as to why not? For reference when I submit the form I get another error which says ' Notice: Undefined variable: bound in C:\xampp\htdocs\editartist.php' but I think thats down to fact that when you search you no longer have the id anymore. I've left a bit of code to show.
<?php
if(isset($_GET['id']))
{
$artistID = fix_string($_GET['id']);
$sql = ("SELECT artName FROM artist WHERE artID = '$artistID' ");
$result = $conn->prepare($sql);
$result->execute();
$result->bind_result($bound);
$result->fetch();
}
else {
echo "this is broken";
}
?>
<form method="post" action="editartist.php"/>
<?php echo '<input type="text" name="artistname" value= "'.$bound.'">' ?>
<input type="submit" value="Save"/>
</form>
<?php
if(isset($_GET['id'])) {
if(isset($_GET['artistname'])) {
$userinput = $_GET['artistname'];
echo "$userinput $artistID";
$sqltwo = ("UPDATE artist SET artName='$userinput' WHERE artID='$artistID'");
$stmt = $conn->prepare($sqltwo);
$stmt->execute();
} else {
echo "this is broken 2";
}
}
?>
This isn't a duplicate, its not asking about the 2nd error. The primary question is why the user input isn't being read?