Hi I'm new on the web and do not understand it well, sorry if I make one mistake. I'm from Argentina, my English is very poor
I am creating my site a news system with categories. The news is that according to the category selected, but if not select any category, then displays all news.
At the same time I create a modular system for the Web, which is the next:
<ul class="top_menu">
<li><a href="?id=noticias.php">Inicio</a></li>
<li><a href="?id=reglamento.php">Reglamento</a></li>
<li><a href="?id=registro.php">Registro</a></li>
<li><a href="#">Estadisticas</a></li>
<li><a href="#">Staff</a></li>
<li><a href="#">Nuestra Historia</a></li>
<li><a href="#">Preguntas Frecuentes</a></li>
<li><a href="#">Foro</a></li>
<li><a href="#">Contacto</a></li>
</ul>
<div class="main_con">
<?php
if(isset($_GET['id'])){
$pag = $_GET['id'];
}else{
$pag = "noticias.php";
}
include "modulos/".$pag;
?>
</div>
The problem I have is that when you select a category fails me:
Warning : include (modulos / 2) [ function.include ]: failed to open stream: No existe el fichero o directorio en C: \\ xampp \\ htdocs \\ index.php on line 75
Warning : include () [ function.include ]: No se pudo ('., C: \\ xampp \\ php \\ pear \\' include_path =) apertura 'modulos / 2 "para su inclusión en C: \\ xampp \\ htdocs \\ index.php on line 75
the php code to add a new category is this:
<?php
include ('db-cnx.php');
if(isset($_POST['enviar']) && $_POST['enviar'] == 'Enviar'){
if(!empty($_POST['catCategoria'])){
$catCategoria = $_POST['catCategoria'];
$sqlInsertCat = mysql_query("INSERT INTO sn_categorias (catCategoria)
VALUES ('$catCategoria')", $db_link)
or die(mysql_error());
echo "Los datos fueron gurdados correctamente";
}else{
echo "Debe llenar el formulario";
}
}
?>
<form name="categoria" action="<?php $_SERVER['PHP_SELF'] ?>" method="post">
<p>
Nueva Categoría<br />
<input type="text" name="catCategoria" />
<input type="submit" name="enviar" value="Enviar" />
</p>
</form>
How I can fix the error?
First off, it's a VERY bad idea to include files via GET. If your security isn't right, you could access files you have no business touching.
Second, you're referencing a file that doesn't exist. Fix the path or filename and it should work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.