Ir para conteúdo
Fórum Script Brasil

frutuoso

Membros
  • Total de itens

    3
  • Registro em

  • Última visita

Sobre frutuoso

frutuoso's Achievements

0

Reputação

  1. Pode me ajudar com o código abaixo, o que faz o script PHP (Sou iniciante). <label>Conjunto</label><input type="checkbox" id="AtivaConjunto" name="AtivaConjunto" value="S" <?php if($Produto->AtivaConjunto === 'S') { echo 'checked'; } ?> >
  2. estou com o mesmo problema, parece que estamos usando o mesmo livro... como você resolveu ??
  3. frutuoso

    Erro de variavel

    Amigos, Boa Noite! Sou iniciante em programação PHP. Estou criando uma pagina básica conforme livro que estou estudando (Desenvolvimento Web com PHP e Mysql - Casa do Codigo - Evaldo Junior Bento). Finalizei capitulo para criação de uma pagina para cadastro de tarefas, porém ao tentar carrega-la esta retornando a mensagem: Notice: Undefined variable: lista_tarefas in /var/www/tarefas/template.php on line 71 Warning: Invalid argument supplied for foreach() in /var/www/tarefas/template.php on line 71 Segue abaixo Codigo complento: tarefas.php <?php session_start(); if (isset($_GET['nome']) && $_GET['nome'] != '') { $tarefa = array(); $tarefa['nome'] = $_GET['nome']; if (isset($_GET['descricao'])) { $tarefa['descricao'] = $_GET['descricao']; } else { $tarefa['descricao'] = ''; } if (isset($_GET['prazo'])) { $tarefa['prazo'] = $_GET['prazo']; } else { $tarefa['prazo'] = ''; } if (isset($_GET['prioridade'])) { $tarefa['prioridade'] = $_GET['prioridade']; } else { $tarefa['prioridade'] = ''; } if (isset($_GET['concluida'])) { $tarefa['concluida'] = $_GET['concluida']; } else { $tarefa['concluida'] = ''; } $_SESSION['lista_tarefas'][] = $tarefa; } include "template.php"; ?> --------------------------------------------------------------------------- template.php <html> <head> <meta charset="uft-8" /> <title>Gerenciador de Tarefas</title> <link rel="stylesheet" href="tarefas.css" type="text/css" /> </head> <body> <h2>Gerenciador de Tarefas</h2> <form> <fieldset> <legend>Nova Tarefa</legend> <label> Tarefa: <br> <input type="text" name="nome" /> </label> <br> <br> <label> Descrição (Opcional): <br> <textarea name="descricao"></textarea> </label> <br> <br> <label> Prazo (Opcional): <br> <input type="text" name="prazo" /> </label> <br> <br> <legend>Prioridade:</legend> <label> <input type="radio" name="prioridade" value="baixa" checked /> Baixa <input type="radio" name="prioridade" value="media" /> Média <input type="radio" name="prioridade" value="alta" /> Alta </label> <br> <br> <label> Tarefa Concluida: <input type="checkbox" name="concluida" value="sim" /> </label> <br> <br> <br> <input type="submit" value="cadastrar" /> </fieldset> </form> <table> <tr> <th>Tarefas</th> <th>Descricao</th> <th>Prazo</th> <th>Prioridade</th> <th>Concluida</th> </tr> <?php foreach ($lista_tarefas as $tarefa): echo "Tarefa: . $tarefa" ?> <tr> <td><?php echo $tarefa['nome']; ?></td> <td><?php echo $tarefa['descricao']; ?></td> <td><?php echo $tarefa['prazo']; ?></td> <td><?php echo $tarefa['prioridade']; ?></td> <td><?php echo $tarefa['concluida']; ?></td> </tr> <?php endforeach; ?> </table> </body> </html>
×
×
  • Criar Novo...