Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Teste para estágio - Tmontec</title>
- <link rel="stylesheet" href="css/style.css">
- </head>
- <body>
- <h1>Tmontec</h1>
- <form action="" method="post" >
- <div class="form-control">
- <label for="nome">Nome:</label>
- <input type="text" id="nome" name="nome">
- </div>
- <div class="form-control">
- <label for="email">Email:</label>
- <input type="email" id="email">
- </div>
- <div class="form-control">
- <label for="telefone">Telefone:</label>
- <input type="text" id="telefone">
- </div>
- <div class="form-control">
- <label for="celular">Celular:</label>
- <input type="text" id="celular">
- </div>
- <div class="form-control">
- <label for="assunto">Assunto:</label>
- <input type="text" id="assunto" name="assunto">
- </div>
- <div class="form-control">
- <label for="mensagem">Redação:</label>
- <textarea name="" id="redacao" cols="30" rows="10"></textarea>
- </div>
- <div class="form-control">
- <button type="button">Enviar</button>
- </div>
- <div class="form-control">
- <input type="reset" value="Limpar">
- </div>
- </form>
- <script src="js/script.js"></script>
- </body>
- </html>
- <?php
- $host = "localhost";
- $user = "root";
- $pass = "";
- $database = ""
- $data = array_map('trim', $_REQUEST);
- try {
- $conn = new PDO("mysql:host=$host;dbname=cubo_estagio", $user, $pass);
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- return "Formulário salvo com sucesso";
- $stmt = $conn->prepare('INSERT INTO teste(nome, email, telefone, celular, assunto, redacao) VALUES(:nome, :email, :telefone, :celular, :assunto ,:redacao)');
- $stmt->bindValue(':id', 1);
- $stmt->execute();
- ));
- if($stmt->rowCount() > 0){
- return "Formulário salvo com sucesso";
- }
- }
- catch(PDOException $e)
- {
- echo "Connection failed: " . $e->getMessage();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement