Ya se puede cerrar el tema ya lo he implantado bien =)
Código PHP:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Comentario</title>
<style type="text/css">
<!--
.header {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 36px;
color: #00F;
font-weight: bold;
text-align: center;
}
.copy {
font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
font-size: 10px;
color: #000;
}
-->
</style>
</head>
<body>
<table width="100%" height="100%" border="8">
<tr>
<td height="70" colspan="2" bgcolor="#009999" class="header">SISTEMA DE COMENTARIOS V1.0</td>
</tr>
<tr>
<td height="100%" colspan="2" valign="top" bgcolor="#CCCCCC"><p><br>
<?
include 'connect_db.php';
//Asignamos las variables para el metodo post
$nombre = $_POST['nombre'];
$tema = $_POST['tema'];
$texto = $_POST['texto'];
if ($nombre==NULL) {
echo "<script type=\"text/javascript\">window.alert(\"Inserte un nombre\");</script>";
}
if ($tema==NULL) {
echo "<script type=\"text/javascript\">window.alert(\"Inserte un tema\");</script>";
}
if ($texto==NULL) {
echo "<script type=\"text/javascript\">window.alert(\"Inserte un texto\");</script>";
}
else {
//INSERTAMOS LOS REGISTROS
$query = "INSERT INTO comentarios (nombre, tema, texto) VALUES('$nombre','$tema','$texto')";
mysql_query($query) or die(mysql_error());
}
?>
<h1>
<div align="center">Lectura de comentarios</div></h1>
<?
$result=mysql_query("select * from comentarios");
?>
<table width="100%" height="77" border="8" align="center">
<tr>
<th width="20%" height="40"><div align="left">NOMBRE</div></th>
<th width="20%" height="40"><div align="left">TEMA</div></th>
<th width="40%" height="40"><div align="left">TEXTO</div></th>
<th width="10%" height="40"><div align="left">BORRAR</div></th>
<?php
while($row = mysql_fetch_array($result)) {
printf("<tr><td> %s</td><td> %s </td><td> %s </td><td><a href=\"borra.php?id=%d\">Borra</a></td></tr>", $row["nombre"],$row["tema"],$row["texto"],$row["id"]);
}
mysql_free_result($result);
?>
</table></p>
</select>
<br>
<INPUT TYPE="SUBMIT" value="Borrar">
</FORM>
</div>
<p> </p></td>
</tr>
<tr>
<td width="19%" height="30" bgcolor="#CCCCCC" class="copy">Realizado por: José Antonio de la Torre </td>
<td width="81%" bgcolor="#CCCCCC" class="copy">Http://kimizombie.webs.com</td>
</tr>
</table>
</body>
</html>
BORRA.PHP
Código PHP:
<?php
include("connect_db.php");
$id=$_GET['id'];
mysql_query("delete from comentarios where id = $id");
header("Location: muestra.php");
?>