este es el formulario
Código HTML:
<!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> <style type="text/css"> <!-- .izq { text-align: left; } --> </style></head> <body> <form action="enviar.php" method="post"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <th width="20%" height="52" scope="col">Caratula:</th> <th width="80%" class="izq" scope="col"><input type="text" class="input" name="imagen" style="width:399px; text-align: left;" maxlength="50"></th> </tr> <tr> <th height="49" scope="row">Nombre:</th> <td><input type="text" class="input" name="nombre" style="width:199px; text-align: left;" maxlength="50"></td> </tr> <tr> <th height="48" scope="row">Año</th> <td><input type="text" class="input" name="año" style="width:100px; text-align: left;" maxlength="50"></td> </tr> <tr> <th height="79" scope="row">Servidores:</th> <td><p><input type="text" class="input" name="servidor" style="width:399px; text-align: left;" maxlength="50"> (Ejem: Rapidshare, Megaupload)</p></td> </tr> <tr> <th height="74" scope="row">Detalles:</th> <td><textarea class="input" style="width:480px; height:100px; padding:5px" name="detalles"></textarea></td> </tr> <tr> <th height="71" scope="row">Enlaces de descarga:</th> <td><textarea class="input" style="width:480px; height:100px; padding:5px" name="enlaces"></textarea></td> </tr> <tr> <th height="71" scope="row"><input type="submit" value="Publicar"></th> <td> </td> </tr> </table> </form> </body> </html>
Este es el enviar.php
Código PHP:
<?
//recibimos las variables enviadas por el formulario
$caratula=$_POST[caratula];
$nombre=$_POST[nombre];
$año=$_POST[año];
$servidor=$_POST[servidor];
$detalles=$_POST[detalles];
$enlaces=$_POST[enlaces];
//conectamos a la base
$connect=mysql_connect("xxxxx","xxxxxx","xxxxxx");
//Seleccionamos la base
mysql_select_db("xxxxxxx",$connect);
//insertamos los registros almacenados en las variables
mysql_query("insert into noticias(caratula,nombre,año,servidor,detalles,enlaces",$connect)
?>