<?php include 'cabecalho.php'; include 'anotacao-banco.php'; include 'conexao.php'; $posts = listaAnotacao($conexao); $i = 0; /*SUMARIO*/ echo '<section id="reference">'; echo '<h1>Anotações:</h1>'; foreach ($posts as $post) { echo '<div>'; echo '<a href="#">' . $post['titulo'] . '</a>' . '</br>'; echo '</div>'; } echo '</section>'; echo '<div id="container">'; echo '<article>'; foreach ($posts as $post) { //TODOS AS ANOTAÇÕES $i++; echo '<div class="date-style" id="criei' . $i . '"><p>' . date('d/m/Y', strtotime($post['data'])) . '</p></div>'; echo '<h1>' . $post['titulo'] . '</h1>'; echo '<p>' . $post['content'] . '</p>'; } echo ' </article>'; echo '</div>'; include 'rodape.php';
<form action="inserir-anotacao.php" method="post"> <label for="tituloId">Titulo: </label> <input type="text" name="titulo" id="tituloId" placeholder="Informe o novo titulo"><br> <textarea name="content" placeholder="Informe aqui seu novo post"></textarea> <input type="text" name="data" id="dataId" placeholder="Informe a data" value= "<?php echo date('Y-m-d H:i:s'); ?> "</input><br> <input type="submit" name="send" id="sendId" value="Enviar"> </form> </section> <section id="titulos-section"> <h2>Selecione o post que deseja editar: </h2> <ul> <?php $anotacoes = listaAnotacao($conexao); if ($anotacoes == '') { echo '<h2> Nenhum post foi adicionado </h2>'; } else { foreach ($anotacoes as $anotacao) { echo '<li>'; echo '<a href="painel.php?id=' . $anotacao['id'] . '"' . ' >' . $anotacao['titulo'] . '</a>'; echo '</li>'; } } ?> </ul> </section> <?php if (isset($_GET['id'])) {