Hallo PhP Forum User
ich brauche euere hilfe ich habe eine tabelle mit todos und möchte es über modal bearbeiten ohne das die seite neu laden muss und wende mich jetzt an euch wie bekomme ich das hin das die modal ohne die seite neu zu laden die aktuellen daten angezeigt werden jede todo hat eine eigene id und die solle geöffnet werden mit den aktuellen daten die in der datenbank stehen offfe ihr könnt mir helfen weil javascripting oder ajax da binn ich noch nicht so weit das muss ich noch lernen umd hoffe ihr könnt mir helfen
Hoffe ihr könnt mir helfen
ich brauche euere hilfe ich habe eine tabelle mit todos und möchte es über modal bearbeiten ohne das die seite neu laden muss und wende mich jetzt an euch wie bekomme ich das hin das die modal ohne die seite neu zu laden die aktuellen daten angezeigt werden jede todo hat eine eigene id und die solle geöffnet werden mit den aktuellen daten die in der datenbank stehen offfe ihr könnt mir helfen weil javascripting oder ajax da binn ich noch nicht so weit das muss ich noch lernen umd hoffe ihr könnt mir helfen
PHP-Code:
echo'<button data-target="#view" data-toggle="modal" name="viewtodo" title="'.LoadLang('#VIEW#').'" value="'.$id.'" class="btn btn-outline-secondary btn-icon waves-effect waves-themed mr-2"><i class="fal fa-eye fs-xl"></i></button>';
PHP-Code:
<?php
if(isset($_POST['viewtodo']) OR isset($_POST['viewtodo_x']) OR isset($_POST['viewtodo_y'])){
$TD = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM ".$GLOBALS['prefix']."admin_todo WHERE id = '".mysqli_real_escape_string($mysqli, $_POST['viewtodo'])."'")); ?>
<!-- Modal Center Transparent -->
<div class="modal" id="view" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-centered modal-transparent" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title text-white"><?php echo $TD['title']; ?></h4>
<button type="button" class="close text-white" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"><i class="fal fa-times"></i></span></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="example-input-square" class="form-label"><?php echo LoadLang('#STATUS#'); ?></label>
<select name="active" class='form-control custom-select'>
<option style='background-color:#FFF' value="1" <?php if(isset($TD['active']) AND $TD['active'] == '1'){echo'selected="selected"';}?>> <?php echo LoadLang('#ENABLED#'); ?> </option>
<option style='background-color:#FFF' value="0" <?php if(isset($TD['active']) AND $TD['active'] == '0'){echo'selected="selected"';}?>> <?php echo LoadLang('#DISABLED#'); ?> </option>
</select>
</div>
</div>
<div class="col-lg-6">
<div class="form-group mb-3">
<label for="example-input-pill" class="form-label"><?php echo LoadLang('#ACCESS#'); ?></label>
<select name="visible" class='form-control custom-select'>
<option style='background-color:#FFF' value="all" <?php if(isset($TD['visible']) AND $TD['visible'] == 'all'){echo'selected="selected"';}?>> <?php echo "".LoadLang('#GLOBAL#')." / ".LoadLang('#ALL#').""; ?> </option>
<?php $vsbla = mysqli_query($mysqli, "select * from ".$GLOBALS['prefix']."admin");
while($vsblb = mysqli_fetch_array($vsbla, MYSQLI_ASSOC)){ ?>
<?php extract($vsblb); ?>
<option <?php if(isset($TD['visible']) AND $username == $TD['visible']){echo'selected="selected"';} ?> value="<?php echo $username; ?>" /><?php echo "".LoadLang('#ADMIN#').": $username"; ?></option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="form-group mb-3">
<label for="example-input-square" class="form-label"><?php echo LoadLang('#TITLE#'); ?></label>
<input type='text' name='title' value='<?php if(isset($TD['title'])){ echo $TD['title']; } ?>' placeholder='<?php echo LoadLang('#TITLE#'); ?>' class='form-control'/>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="form-group">
<label for="example-input-square" class="form-label"><?php echo LoadLang('#TEXT#'); ?></label>
<textarea name='text' rows='50' style='overflow:auto;' id='editor-todo'><?php if(isset($TD['text'])){ echo $TD['text']; } ?></textarea>
<script>CKEDITOR.replace('editor-todo');</script>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-danger float-left waves-effect waves-themed" data-dismiss="modal">Close</button>
<button name="edittodo" value="<?php if(isset($TD['id'])){ echo $TD['id']; } ?>" class="btn btn-outline-success float-right waves-effect waves-themed"> <?php echo LoadLang('#SAVE#'); ?> </button>
</div>
</div>
</div>
</div>
<!-- Modal Default Transparent -->
<script language="javascript">document.location="#view";</script>
<script>
$(document).ready(function(){
$("#view").modal();
});
</script>
<?php }
Kommentar