i have a php app with 3 table, each one have multiple row with button for each row to get a form for the affected data
the idea is to give a value for the modal to have as much column as in the affected table.
until now, i tried to have one form with button fo each table, with different value, and testing it in php to use the correct table for for the column as below in the code (it's a test webpage so there is just one button, i'm just trying to open a modal manually after testing a php value ) :
<body>
<form action="" method="post">
<button type="submit" class="btn btn-primary" data-bs-toggle="modal" data-bs-
target="#CreateInfra" name="der">
Launch demo modal
</button>
</form>
<script>
function modal(){
$("#myModal").modal('show');
}
</script>
<div class="bs-example">
<!-- Modal HTML -->
<div id="myModal" class="modal fade" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Modal Title</h5>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<p>This is a simple Bootstrap modal. Click the "Cancel button", "cross icon" or
"dark gray area" to close or hide the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data
dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary">Save</button>
</div>
</div>
</div>
</div>
</div>
<?php
if (isset($_POST['der'])){
$value = 1;
var_dump($value);
}
else{
$value=2;
var_dump($value);
}
if ($value == 1){
echo "<script>modal()</script>";
}
?>
</body>
the thing is , when i hit the button, i see my page loading something for maybe 0.4 second but nothing happen.
is there any way to do this or i should use something else ?
question from:
https://stackoverflow.com/questions/66061253/how-to-open-bootstrap-modal-with-different-php-value 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…