Completed

Ajuste em Formulario Html5 na função onchange usando banco de dados Mysql em Php

Published on the January 28, 2018 in IT & Programming

About this project

Open

Eu tenho um formulário HTML5 e quando eu altero os campos eu preciso que através da função onchange quando alterar o campo o conteúdo do campo seja salvo em banco. Estou usando o PHP e tenho certa urgência nessa alteração.

Em anexo envio os códigos.

Em resumo no banco já estará um índice, dai quando o usuario muda de campo puxa pelo indice e atualiza o banco.

<!doctype html>
<html lang="pt">
    <head>
        <meta charset="utf-8">
        <title>formulario de autorização</title>
        <link rel="stylesheet" href="estilo.css">
    </head>
    <body>
   
    <script>
/*
    require_once '../Config.php';
*/   
    function myFunction() {
/*    require_once '../Config.php';
    $datainsert = "insert into tblteste (nome, cpf, email, telefone) values ('teste', 'teste1', 'teste2', 'teste3')";
    mysqli_query($db, $datainsert);
*/   
    alert("the input value has changed. The new value is: ");

    }

    function myFunction2() {
    $.ajax({
      url:'meuajax.php',
    }); 
    }

    </script>
   
    <h1>Formulario de Registro</h1>
    <form action="registrar.php" method="post" class="form-register">
        <h2 class="form-titulo">Dados Beneficiario</h2>
            <div class="contenedor-inputs">
                <input type="text" id="nome" name="nome" placeholder="Digite seu nome completo" onchange="myFunction()" class="input-100" required >
                <input type="email" id="email" name="email" placeholder="Digite seu email" onchange="myFunction2()" class="input-100" required>               
                <input type="text" id="cpf" name="cpf" placeholder="Digite seu CPF" class="input-100" required>
                <input type="text" id="telefone" name="telefone" placeholder="Digite seu Telefone Celular com DDD" class="input-100" required>
                <input type="submit" onclick="enviarsender()" value="Enviar" class="btn-enviar">
                <input type="hidden" name="sender" value="<?= $_GET['sender'] ?>"/>
                <input type="hidden" name="ok" value="<?= $_GET['ok'] ?>"/>
            </div>
        </form>
    </body>
</html>

Category IT & Programming
Subcategory Web development
What is the scope of the project? Small change or bug
Is this a project or a position? Project
I currently have I have specifications
Required availability As needed
Roles needed Developer

Delivery term: Not specified

Skills needed

Other projects posted by E. S.