Código:
<?php session_start(); ?> <meta name="HandheldFriendly" content="true" /> <meta name="viewport" content="width=device-width, height=device-height, user-scalable=no" /> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <html> <?php $comercial = strtoupper($_SESSION["k_username"]); ?> <style> body { padding: 0; margin: 0; border: 0; background-color: #07291B; color: white; font-size: 18; } legend { font-weight: bold; letter-spacing: 5px; } fieldset { border-color: #B3D482; border-style: solid; width: 50%; border-radius: 0.5em 0.5em 0.5em 0.5em; font-weight: bold; } input[type="text"] { border: none; background: #B3D482; color: black; border-radius: 0.5em 0.5em 0.5em 0.5em; } textarea, select { border: none; background: #B3D482; color: black; border-radius: 0.5em 0.5em 0.5em 0.5em; } input[type="number"] { border: none; background: #B3D482; color: black; border-radius: 0.5em 0.5em 0.5em 0.5em; } input[type="radio"] { border: none; background: #B3D482; color: black; border-radius: 0.5em 0.5em 0.5em 0.5em; } input[type="email"] { border: none; background: #B3D482; color: black; border-radius: 0.5em 0.5em 0.5em 0.5em; } input[type="date"] { border: none; background: #B3D482; color: black; border-radius: 0.5em 0.5em 0.5em 0.5em; } </style> <head><script> function primera(){ var cantidad=document.getElementById('cantidad').value; var precio=document.getElementById('precio').value; document.getElementById('total').value=cantidad*precio; } </script></head> <body> <div id="header"> <center> <img src="logo.jpg" alt="Articulos religiosos" height="30px" width=""> <font color="red"><?php echo "$comercial"?></font> bienvenido! </center> </div> <form method="post" action="insertar.php"> <div align="center"> <fieldset> <legend> Cliente </legend> <table> <tr> <td>Cliente:</td><td> <input type="text" name="cliente" size="19"/> </td> </tr> <tr> <td>Domicilio:</td><td> <input type="text" name="domicilio" size="19"/> </td> </tr> <tr> <td>Responsable:</td><td> <input name="responsable" type="text" size="19"/> </td> </tr> <tr> <td>Email:</td><td> <input type="email" name="mail" size="19"/> </td> </tr> <tr> <td>Móvil:</td><td> <input type="number" name="movil" size="19"/> </td> </tr> <tr> <td>Comentarios:</td><td> <textarea ></textarea></td> </tr> </table> </fieldset> <fieldset> <legend> Artículo </legend> <table> <tr> <td>Tipo:</td><td> <SELECT NAME="tipo" SIZE=1"> <OPTION VALUE="medalla">Medalla</OPTION> <OPTION VALUE="medalla dos caras">Medalla dos caras</OPTION> <OPTION VALUE="medalla con fotos">Medalla con fotos</OPTION> <OPTION VALUE="llavero">LLavero</OPTION> <OPTION VALUE="llavero con foto">Llavero con fotos</OPTION> <OPTION VALUE="insignia">Insignia</OPTION> <OPTION VALUE="medallita">Medallita</OPTION> <OPTION VALUE="metopa">Metopa</OPTION> </SELECT> </td> </tr> <tr> <td>Concepto:</td><td> <textarea name="concepto"></textarea></td> </tr> </table> <fieldset> <legend> Tamaño </legend> <table> <tr> <td>Altura:</td><td> <input type="number" name="altura" size="19"/> </td> </tr> <tr> <td>Anchura:</td><td> <input name="anchura" type="number" size="19"/> </td> </tr> <tr> <td>Profundidad:</td><td> <input name="profundidad" type="number" size="19"/> </td> </tr> </table> </fieldset> <table> <tr> <td>Enganche:</td><td> <SELECT NAME="enganche" SIZE=1"> <OPTION VALUE="no">No</OPTION> <OPTION VALUE="arriba">Arriba</OPTION> <OPTION VALUE="detrás">Detrás</OPTION> </SELECT></td> </tr> <tr> <td>Terminación:</td><td> <SELECT NAME="terminacion" SIZE=1"> <OPTION VALUE="oro">Oro</OPTION> <OPTION VALUE="plata">Plata</OPTION> <OPTION VALUE="cobre">Cobre</OPTION> <OPTION VALUE="plata oxidada">Plata oxidada</OPTION> <OPTION VALUE="plata mate">Plata mate</OPTION> </SELECT> </td> </tr> <tr> <td>Esmalte:</td><td><SELECT NAME="esmalte" SIZE=1"> <OPTION VALUE="si">Si</OPTION> <OPTION VALUE="no">No</OPTION> </SELECT> </td> </tr> <tr> <td>Color esmalte:</td><td> <input name="color" type="text" size="19"/> </td> </tr> </table> </fieldset> <fieldset> <legend> Imágenes </legend> </fieldset> <fieldset> <legend> Precio </legend> <table> <tr> <td>Cantidad:</td><td> <input id="cantidad" type="number" name="cantidad" size="19"/> uds </td> </tr> <tr> <td>Precio:</td><td> <input id="precio" name="precio" type="number" size="19" onkeyup=" primera();"/>€/und </td> </tr> <tr> <td>Total:</td><td> <input id="total" name="total" type="text" size="19" />€</td> </tr> <td>Fecha limite:</td><td> <input id="limite" type="date" size="19"/></td> </tr> </table> </fieldset> <input type="submit" value="enviar"/> </div> </form> </body> </html>
y este el mysql
Código:
<html> <body> <?php $link = mysql_connect("localhost", "root"); mysql_select_db("php", $link); $sql = "INSERT INTO pedidos (cliente, responsable, mail, movil) VALUES ('$_REQUEST[cliente]', '$_REQUEST[responsable]', '$_REQUEST[mail]', '$_REQUEST[movil]')"; $result = mysql_query($sql); echo "Gracias! Hemos recibido sus datos.\n"; ?> </body> </html>