O Javascript neste caso atuaria em 2 lugares. No primeiro, ele funcionaria para aparecer e desaparecer o formulario de inserção de daods, e no segundo, ele atuaria em uma mensagem de confirmação de inserção de dados.
Porém, por uma força maior, ele mão está funcionando :mellow:
Já tentei de tudo... por isso venho até aki poedir a ajuda de vocês.
O resultado dessa página é:
FIREFOX e IE7:
Notice: Undefined index: btn in C:\wamp\www\SOM LIVRE\programacao_edit.php on line 24
INSERIR PROGRAMAÇÃO
Aparece o link em "INSERIR PROGRAMAÇÃO", mas ele não faz nada.
Pergunta
Lukaumfera
Pessoal, estpu tentando desenvolver um site em PHP com o seguinte código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Editar Programação</title> </head> <script language="javascript"> <!-- function aparecer(id) { var mostrar = document.getElementByID(id); if (mostrar.style.display == ""){ mostrar.style.display = "none"; }else{ mostrar.style.display = ""; } } --> </script> <? include "config.php"; if ($_GET['btn'] == "gravar"){ $data = $_POST["data"]; $local = $_POST["local"]; $gravar_dados = mysql_query ("INSERT INTO programacao (data, local) VALUES ('$data','$local')",$db); if ($gravar_dados == 1) { print" <META HTTP-EQUIV=REFRESH CONTENT='0 URL=programacao_edit.php'> <script type=\"text/javascript\"> alert (\"Programação atualizada com sucesso.\"); </script> "; } } ?> <body> <a href="#" onclick="aparecer('form'); return false;">INSERIR PROGRAMAÇÃO</a></p> <div id="form" style="display:none"> <form name="form1" id="form1" method="post" action="?btn=gravar"> <table width="211" border="0" cellspacing="2" cellpadding="2"> <tr> <td width="44">Data</td> <td width="153"><label> <input type="text" name="data" id="data" /> </label></td> </tr> <tr> <td>Local</td> <td><label> <input name="local" type="text" id="local" maxlength="100" width="300"/> </label></td> </tr> </table> <p> <label> <input type="submit" name="button" id="button" value="Gravar" /> </label> </p> </form> </div> </body> </html>O Javascript neste caso atuaria em 2 lugares. No primeiro, ele funcionaria para aparecer e desaparecer o formulario de inserção de daods, e no segundo, ele atuaria em uma mensagem de confirmação de inserção de dados.
Porém, por uma força maior, ele mão está funcionando :mellow:
Já tentei de tudo... por isso venho até aki poedir a ajuda de vocês.
O resultado dessa página é:
FIREFOX e IE7:
Notice: Undefined index: btn in C:\wamp\www\SOM LIVRE\programacao_edit.php on line 24
INSERIR PROGRAMAÇÃO
Aparece o link em "INSERIR PROGRAMAÇÃO", mas ele não faz nada.
Help! :wacko:
Editado por LukaumferaLink para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.