Reputation: 638
I'm trying to write a modal dialog that should display a field of my SQL query result for example I'll run
select * from users where salary IS NULL;
I want to create a button with the users who have no salary set I should be getting adel ahmed as buttons on the modal dialog here's my code:
if ($rows > 0) {
echo "some employees have not been assigned an hourly rate yet"; ?>
<br> <input class="btn btn-primary" type="button" value="set salaries" data-toggle="modal" data-target="#salaryModal"/>
<div class="modal fade" id="salaryModal" >
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="form-group ">
<?php while($row = mysqli_fetch_assoc($auth)) {
$username = $row["username"]; ?>
<input class="btn btn-success" onclick="sayHello()" id="calculate_salary_button" value="<?php echo $username;} ?>"/></a> <br>
</div>
<?php } } ?>
outside the modal dialog, I echo the usernames coorectly, here however I get one button:
adel
Upvotes: 0
Views: 315
Reputation: 1828
You got a }
in your
value="<?php echo $username;} ?>"
Which ends the while loop after the first run.
And your input
fields ID's must be unique
Upvotes: 1