este es mi formulario:
Código:
y este es el PHP que procesa los datos :<!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>Creación de un portal con PHP y MySQL</title> </head> <body bgcolor="#303030"> <body text="#E5E5E5"> <font face="tahoma"> <font size="2"> <body link="#E5E5E5" vlink="E0E0E0"> <p align="center"> <font size="4"> <u>Formulario para insertar un mensaje en el foro</u> </font> </p> <form action="addforo.php"> <input type="hidden" name="respuestas" value="<?php echo $respuestas; ?>"> <input type="hidden" name="identificador" value="<?php echo $id; ?>"> AUTOR:<input type="text" name="autor" size="25"> <br> <br> TITULO:<input type="text" name="titulo" size="25"> <br> <br> MENSAJE:<textarea name="mensaje"> </textarea> <br> <br> <input type=submit value="Enviar"> </form> </body> </html>
Código:
por lo que se mi error ha de estar en el codigo,, pero no lo encuentro espero su ayuda muchas gracias..... o si tienen algo mas sencillo, se los agradeceria.<!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>Creación de un portal con PHP y MySQL</title> </head> <body bgcolor="#303030"> <body text="#E5E5E5"> <font face="tahoma"> <font size="2"> <body link="#E5E5E5" vlink="E0E0E0"> <p align="center"> <font size="2"></font> <?php $host="localhost"; $user="root"; $password="root"; $db="foro"; $enlace=mysql_connect($host,$user,$password); mysql_select_db($db,$enlace); $fecha=time(); if(empty($identificador)) {$identificador=0;} $respuesta=$respuestas+1; $sql="INSERT INTO foro1 (autor, titulo, mensaje, fecha, identificador) VALUES ('$autor','$titulo', '$mensaje', '$fecha', '$identificador')"; mysql_query($sql); $sql2="UPDATE foro1 SET respuestas='$respuesta' WHERE id = '$identificador'"; mysql_query($sql2); $resultado=mysql_query("SELECT '$mensaje' FROM foro1 WHERE mensaje='$mensaje'",$enlace); while($registro = mysql_fetch_row($resultado)) { echo"<tr>"; foreach($registro as $clave) { echo"<td>",$clave,"</td>"; } } echo "<br><br>"; echo "<a href=indexforo.php>Volver al foro</a> </font> </center>"; ?> </body> </html>
saludos