• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 195

Backtrace:

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/views/question.php
Line: 195
Function: _error_handler

File: /home/u125378470/domains/lawhelpguru.org/public_html/application/controllers/Questions.php
Line: 416
Function: view

File: /home/u125378470/domains/lawhelpguru.org/public_html/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

php post the drop down list value on the same page

<button aria-describedby="--stacks-s-tooltip-2i9ia1ei" aria-label="Bookmark" aria-pressed="false" class="js-bookmark-btn s-btn s-btn__unset c-pointer py4 js-gps-track" data-controller="s-tooltip" data-gps-track="post.click({ item: 1, priv: 0, post_type: 1 })" data-s-tooltip-placement="right" data-selected-classes="fc-yellow-600"></button><svg aria-hidden="true" class="mln2 mr0 svg-icon iconHistory" height="18" viewbox="0 0 19 18" width="19"></svg>

 

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