Ver Mensaje Individual
  #20 (permalink)  
Antiguo 09/09/2011, 06:26
lokor712
 
Fecha de Ingreso: septiembre-2011
Mensajes: 38
Antigüedad: 12 años, 8 meses
Puntos: 5
Respuesta: [APORTE] Sistema de noticias y comentarios

Bueno, les he creado unos archivos que crean una categoria, los archivos son agcat.php y agregarcategoria.php

agcat.php
Código PHP:
<!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=iso-8859-1" />
<title>Agregar Categoria</title>
</head>

<body>
<form action="agregarcategoria.php" method="post">
    <input type="hidden" name="id" value="<?php echo $id;  ?>"><br>
    Categoria:<br>
    <input type="text" name="categoria"><br>
    <br>
    <input type="submit" value="Crear"><br>
    </form>

</body>
</html>
agregarcategoria.php
Código PHP:
<!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=iso-8859-1" />
<title>Agrega una categor&iacute;a</title>
</head>

<body>
<p>
  <?php
require ('includes/connect.php');
$id=$_POST['id'];
$categoria=$_POST['categoria'];
$query "INSERT INTO categoria (id,categoria) VALUES('$id','$categoria')";
    
mysql_query($query) or die(mysql_error());
    echo 
"Los datos se han guardado correctamente.";
?>
</body>
</html>
Bueno, lo he creado yo estos archivos, y estoy contento ya que es de las primeras cosas que hago solito desde que he empezado hace poco con el PHP :D :D :D

Un Saludo!!