I have a problem with the post, I can not post the value on the same page.
$result = mysqli_query($con, "SELECT * FROM bgu_characters") or die(mysqli_error($con));
$ID=$_POST['charactets'];
$result2 = mysqli_query($con, "SELECT * FROM bgu_characters where cid='$ID' ") or die(mysqli_error($con));
while($row = mysqli_fetch_array($result2))
{
?>
<form id= name="myform" method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
class="form-group">
<label for="firstname">FirstName:</label>
<input type="text" name="firstname" class="form-control" value="<?php echo $row['bgu_fname']; ?>">
</div>
<div class="form-group">
<label for="lastname">LastName:</label>
<input type="text" name="lastname" class="form-control" value="<?php echo $row['bgu_lname']; ?>">
</div>
<div class="form-group">
<label for="beta">Description:</label>
<textarea name="beta" class="form-control"> <?php if($row['bgu_description']){echo $row['bgu_description'];} ?></textarea>
<?php
}
?>
<select name= method=post action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>">
<?php
while($row = mysqli_fetch_array($result))
{
$id =$row ['cid'];
$FNames = $row ['bgu_fname'];
$LNames = $row ['bgu_lname'];
echo "'>$FNames $LNames $id";
}
?>
</select>
what I want to do is using a drop-down list to display all the data from MYSQL, once it selects the characters it should display all the information on the form, but somehow the drop-down list does not pass the id that is selected. I try the SQL using where cid = '2' and it works