Ocladeson 0 Denunciar post Postado Maio 24, 2015 Amigos queria que meu script redireciona-se para uma pagina html como posso fazer isso ? script PDO <?php require_once("conection/conexao.php"); try { } if( empty($_POST['nome']) ) { throw new Exception("idade", 1); } if( empty($_POST['nome]) ) { throw new Exception("idade", 1); } $holderCPF = $_POST['nome']; $holderBornDate = $_POST['idade']; $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $pdo->prepare("INSERT INTO `form_test` (` nome`, `idade`) VALUES(:nome, :idade)"); $stmt->execute(array( "nome" => $nome, "idade" => $idade, )); if( $pdo->lastInsertId() > 0 ) { echo("Dados inserido com sucesso !"); } else { throw new Exception("Falha ao cadastrar", 1); } } catch (PDOException $e) { echo 'Error debug'. $e->getMessage(); } catch (Exception $e) { echo 'Error debug'. $e->getMessage(); } ?> obg ! achei o script ! echo '<meta HTTP-EQUIV="Refresh" CONTENT="2; URL=.html">'; Compartilhar este post Link para o post Compartilhar em outros sites
Jeovane Carvalho 6 Denunciar post Postado Maio 24, 2015 Amigos queria que meu script redireciona-se para uma pagina html como posso fazer isso ? script PDO <?php require_once("conection/conexao.php"); try { } if( empty($_POST['nome']) ) { throw new Exception("idade", 1); } if( empty($_POST['nome]) ) { throw new Exception("idade", 1); } $holderCPF = $_POST['nome']; $holderBornDate = $_POST['idade']; $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $pdo->prepare("INSERT INTO `form_test` (` nome`, `idade`) VALUES(:nome, :idade)"); $stmt->execute(array( "nome" => $nome, "idade" => $idade, )); if( $pdo->lastInsertId() > 0 ) { echo("Dados inserido com sucesso !"); } else { throw new Exception("Falha ao cadastrar", 1); } } catch (PDOException $e) { echo 'Error debug'. $e->getMessage(); } catch (Exception $e) { echo 'Error debug'. $e->getMessage(); } ?> obg ! achei o script ! Troque isto: echo '<meta HTTP-EQUIV="Refresh" CONTENT="2; URL=.html">'; por isso: echo "<script>alert('** Mensagem enviada com Sucesso: **');</script>"; echo "<script language='javascript'>history.back()</script>"; echo "<script>window.location = \"sua_pagina.php\"</script>"; Espero ter ajudado. Compartilhar este post Link para o post Compartilhar em outros sites