Jump to content

goncalo_gmp

Members
  • Content count

    1
  • Joined

  • Last visited

Everything posted by goncalo_gmp

  1. goncalo_gmp

    Erro ao passar dados do form para um modal

    <form method="POST" action="<?php echo $_SERVER['PHP_SELF']?>"> <div class="form-group row"> <label for="title" class="col-sm-2 col-form-label">Title News:</label> <div class="col-sm-9"> <input class="form-control" id="title" name="newTitle" placeholder="New´s Title"> </div> </div> <div class="form-group row"> <label for="state" class="col-sm-2 col-form-labe">State:</label> <div class="col-sm-9"> <select class="form-control" id="state" name="newState"> <option selected>Options</option> <option value="1">Published</option> <option value="2">Unpublished</option> </select> </div> </div> </div> <div class="col-3 mt-5 mb-5"> <a data-toggle="modal" data-target="#exampleModal"s><i class="material-icons">pageview</i></a> </div> <div class="col-1"></div> <div class="col-10 mb-5"> <textarea id="new_text" name="newText" style="height: 400px;"></textarea> <input class="btn btn-outline-dark float-right mt-2" type="submit" name="save_news" value="Save" id="submit"/> </div> </form> Ao clicar no: Abre meu modal: <div class="modal fade bd-example-modal-xl" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog modal-xl" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Preview</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <header class="header"> <img class="img-fluid w-100" src="./img/banner.png" alt="banner" /> <button type="button" class="btn btn-danger m-1" href="">Back</button> <button type="button" class="btn btn-danger float-right m-1" href="">Login</button> </header> <div class="container-fluid"> <div class="row mt-5 text-center"> <div class="col"> <h1><?php echo isset($_POST['newTitle']) ? $_POST['newTitle'] : '';; ?></h1> </div> </div> <div class="row mt-4 text-center"> <div class="col"> <h6>Publicado pelo(a): </h6> <h5><?php echo $_SESSION['UserNome']; ?></h5> </div> <div class="col"> <h6>Publicado em: </h6> <h5><?php echo date('o-m-d'); ?></h5> </div> </div> <div class="row mt-5 text-center"> <div class="col"> <h5><?php echo isset($_POST['newText']) ? $_POST['newText'] : '';; ?></h5> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> </div> </div> </div> </div> </div> Porém na minha página aparece apenas <div class="row mt-4 text-center"> <div class="col"> <h6>Publicado pelo(a): </h6> <h5><?php echo $_SESSION['UserNome']; ?></h5> </div> <div class="col"> <h6>Publicado em: </h6> <h5><?php echo date('o-m-d'); ?></h5> </div> </div> E se retirar a validação dos POST aparece me os erros: Se alguém souber qual o problema que me diga por favor. Obrigado!
×

Important Information

Ao usar o fórum, você concorda com nossos Terms of Use.