Google translate: I'm making a web page, and I want to schedule a comment section to it, that contains the date and time the user commented. Being a first-timer in the subject, I'm doing badly using the JavaScript language for that case; Also AJAX. I wish that once the data is sent to MYSQL, it will be returned to the page.
Google translate: This is my HTML code:
<form name="f_coment" action= "insertar.php" method="POST"> <Label for="nombre">Nombre:</Label> <input type="text" name="nombre" required=""placeholder="Escribe tu nombre..."><br> <label for="email">Email:</label> <input type="email" name="email" required=""placeholder="Escribe tu email..."> <br> <label for="clave">Clave:</label> <input type="password" name="clave" required="" placeholder="Escribe tu clave..."><br> <label for="comentario">Comentario:</label> <textarea type="comentario" name="comentario" cols="90px" rows="8" required="" placeholder="Escriba aquí su comentario..."></textarea><br><br> <input type="submit" value="comentar" id="comentar"> </form>
Google translate: This is my PHP code:
<?php error_reporting(0); $PDO = new PDO('mysql:host=localhost;dbname=db_comentarios;charset=UTF8','root','' ); try { echo "datos enviados correctamente"; $sql=$PDO->prepare("INSERT INTO prueba1(nombre, email, clave, comentario) VALUES (:nombre, :email, :clave, :comentario)"); $sql->bindParam(':nombre',$_POST['nombre']); $sql->bindParam(':email',$_POST['email']); $sql->bindParam(':clave', password_hash($_POST['clave'], PASSWORD_DEFAULT)); $sql->bindParam(':comentario',$_POST['comentario']); $sql->execute(); }catch(PDOException $e) { echo "Fallo de conexion al enviar los datos:".$e->getMessage(); } ?>
Google translate: I would really appreciate any help.
Quote: This is a piece of Java code that I could try:
function getFormValues{ var nombre = document.f_coment.nombre.value; var email = document.f_coment.email.value; var clave = document.f_coment.clave.value; var comentario = document.f_coment.comentario.value; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)