Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa tarde pessoal,
Mais uma vez preciso da ajuda de vocês. Estou com uma aplicação que não está abrindo a página de edição como deveria. Tentei diversas maneiras todas sem sucesso, realizei o mesmo método que utilizo em outra aplicação aqui. Os códigos são esses:
tarefas.php
<?php session_start();
include "conexao_checklist_sdk.php";
$exibir_tabela = true;
function converterDataToPHP($data){
$data = implode("/",explode("-",$data));
return date("d/m/Y H:i", strtotime($data));
}
function converterDataToPHP2($data){
$data = implode("/",explode("-",$data));
return date("d/m/Y", strtotime($data));
}
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'] = '';
}
$tarefa['prioridade'] = $_GET['prioridade'];
if(isset($_GET['concluida'])){
$tarefa['concluida'] = 1;
}
else{
$tarefa['concluida'] = 0;
}
if(isset($_GET['responsavel'])){
$tarefa['responsavel'] = $_GET['responsavel'];
}
else{
$tarefa['responsavel'] = '';
}
}
$lista_tarefas = buscar_tarefas();
$tarefa = array(
'id_tarefas' => 0,
'nome' => '',
'descricao' => '',
'prazo' => '',
'prioridade' => 1,
'concluida' => ''
);
include "template.php";
?>
formulario.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "url=[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/url]
<html xmlns="[url=[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)][http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)">[/url]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="salva_tarefa.php" method="post">
<input type="hidden" name="id_tarefas" id="id_tarefas" value="<?php echo $tarefa['id_tarefas']; ?>" />
<fieldset>
<legend>Nova Tarefa</legend>
<label>
Tarefa:
<input type="text" name="nome" id="nome" value="<?php echo $tarefa['nome']; ?>"/>
</label>
<label>
Descrição:
<textarea name="descricao" value="<?php echo $tarefa['descricao']; ?>"></textarea>
</label>
<label>
Prazo:
<input type="text" class="prazo" name="prazo" value="<?php echo $tarefa['prazo']; ?>"/>
</label>
<label>
Data Inicio: <br />
<input type="date" name="data_inicio" value="<?php echo $tarefa['data_inicio'];?>"/>
</label>
<label>
Data Fim: <br />
<input type="date" name="data_fim" value="<?php echo $tarefa['data_fim'];?>"/>
</label>
<fieldset>
<legend>Prioridade:</legend>
<label>
<input type="radio" name="prioridade" value="Baixa" <?php echo $tarefa['prioridade']?> checked />
Baixa
<input type="radio" name="prioridade" value="Media" <?php echo $tarefa['prioridade']?> />
Média
<input type="radio" name="prioridade" value="Alta" <?php echo $tarefa['prioridade']?>/>
Alta
</label>
</fieldset>
<label>Responsável:
<input type="text" name="responsavel" value=" <?php echo $tarefa['responsavel'] ;?>" />
</label>
<input type="hidden" name="action" id="action" value="<?=$action?>" />
<input type="submit" value="Cadastrar" />
</fieldset>
</form>
</body>
</html>
tabela.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "url=[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/url]
<html xmlns="[url=[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)][http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)">[/url]
<head>
<link rel="stylesheet" type="text/css" href="estilo.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table>
<tr>
<th>Data</th>
<th>Tarefas</th>
<th>Descrição</th>
<th>Prazo</th>
<th>Data Início</th>
<th>Data Fim</th>
<th>Prioridade</th>
<th>Responsável</th>
<th>Ação</th>
</tr>
<?php foreach($lista_tarefas as $tarefa) : ?>
<tr>
<td><?php echo converterDataToPHP($tarefa['data']);?></td>
<td><?php echo $tarefa['nome']; ?></td>
<td><?php echo $tarefa['descricao'];?></td>
<td><?php echo $tarefa['prazo'];?></td>
<td><?php echo converterDataToPHP2($tarefa['data_inicio']);?></td>
<td><?php echo converterDataToPHP2($tarefa['data_fim']);?></td>
<td><?php echo $tarefa['prioridade'];?></td>
<td><?php echo $tarefa['responsavel'];?></td>
<td>
<!-- <a href="../checklistSDK/editar.php?id=<?php// echo $tarefa['id_tarefas'];?>"><img src="../atualizando/icon/editar_tarefa2.png" /></a>
<a href="editar.php"><img src="../atualizando/icon/edit_delete2.png" /></a>-->
<?php
echo " <a href=\"#\" id=\"{$tarefa['id_tarefas']}\"style=' border:0px;'><img src='../atualizando/icon/edit_delete2.png' width=\"20\" height=\"20\" style='border:0px;' alt='Clique para Editar Atividade'/></a>";
echo " <a href=\"#\" id=\"{$campos['id_tarefas']}\"style=' border:0px;'><img src='../atualizando/icon/editar_tarefa2.png' width=\"20\" height=\"20\" style='border:0px;' alt='Clique para Editar SMS'/></a>";
?>
</td>
</tr>
<?php endforeach ; ?>
</table>
</body>
</html>
editar.php
<?php
include "banco.php";
include "conexao_checklist_sdk.php";
$id = $_GET['id_tarefas'];
$busca = mysql_query("SELECT * FROM tarefas WHERE id_tarefas = $id");
$tarefa = mysql_fetch_array($busca);
$action = 'insert';
if(isset ($_GET['id_tarefas']) && $_GET['id_tarefas'] >= 1){
$action = 'update';
$id = $_GET['id_tarefas'];
$rs_site = mysql_query("SELECT * FROM tarefas WHERE id_tarefas =".$_GET['id_tarefas']) or die(mysql_error());
}
$exibir_tabela = false;
function converterDataToPHP($data){
$data = implode("/",explode("-",$data));
return date("d/m/Y H:i", strtotime($data));
}
function converterDataToPHP2($data){
$data = implode("/",explode("-",$data));
return date("d/m/Y", strtotime($data));
}
if(isset($_GET['nome']) && $_GET['nome'] != ''){
$tarefa = array();
$tarefa['nome'] = $_GET['nome'];
if(isset($_GET['descricao'])){
$tarefa['descricao'] = $_GET['descricao'];
}$tarefa['descricao'] = '';
}
if(isset($_GET['prazo'])){
$tarefa['prazo'] = $_GET['prazo'];
}$tarefa['prazo'] = '';
}
$tarefa['prioridade'] = $_GET['prioridade'];
if(isset($_GET['concluida'])){
$tarefa['concluida'] = 1;
}$tarefa['concluida'] = 0;
}
editar_tarefa($tarefa);
}
$tarefa = buscar_tarefa($_GET['id_tarefas']);
include "template.php";
?>
na tabela.php, tem uma parte comentada, trata-se de uma das tentativas que tentei fazer. Quando clico em editar a página abre em branco não dá nenhum erro. Alguém poderia me ajudar ?Carregando comentários...