<!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>Untitled Document</title> </head> <body> <form action="grava.php" method="post" enctype="multipart/form-data" name="forml" id="forml"> <table width="577" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td>Nome:</td> </tr> <tr> <td><form id="nome" name="nome" method="post" action=""> <span id="nome"> <label for="text1"></label> <input type="text" name="nome" id="nome" /> <span class="textfieldRequiredMsg">A value is required.</span></span> </form></td> </tr> <tr> <td>Email:</td> </tr> <tr> <td><form id="email" name="email" method="post" action=""> <span id="email"> <label for="text1"></label> <input type="text" name="email" id="email" /> <span class="textfieldRequiredMsg">A value is required.</span></span> </form></td> </tr> <tr> <td>Dedicatoria:</td> </tr> <tr> <td><form id="dedicatoria" name="" method="post" action=""> <span id="dedicatoriaa"> <label for="dedicatoria"></label> <span id="dedicatoria"> <label for="textarea1"></label> <textarea name="dedicatoria" id="dedicatoria" cols="45" rows="5"></textarea> <span class="textareaRequiredMsg">A value is required.</span></span> </span> </form></td> </tr> <tr> <td><form id="form4" name="form4" method="post" action=""> <input type="submit" name="buttom" id="buttom" value="Enviar" /> </form></td> </tr> </table> </div> <script type="text/javascript"> var nome = new Spry.Widget.ValidationTextField("nome"); var email = new Spry.Widget.ValidationTextField("email"); var dedicatoria = new Spry.Widget.ValidationTextarea("dedicatoria"); </script> </body> </html>
arquivo contecta
<?php $host = "localhost"; $login = "root"; $password = ""; $database = "clientes"; $tabela = "registrar"; $link = mysql_connect($host,$login,$password) or die ("erro ao tentar conectar"); ?>
esse eh o arquivo grava
<?php include('conecta.php');?>
<?php
$nome = $_POST['nome'];
$email = $_POST['email'];
$dedicatoria = $_POST['dedicatoria'];
$query = "INSERT INTO $tabela VALUES ('NULL','$nome','$email',
'$dedicatoria')";
if(mysql_db_query($database, $query, $link)) {
print("<p class=titulo_big> A insersao foi executada com sucesso!</p>");
} else {
print("<p class=titulo_big>A consulta nao foi executada!</p>");
}
mysql_close($link);
?>