Page 1 of 1

Dificult time including stuff to the webpage....

Posted: Tue Jul 15, 2003 12:13 pm
by Bruski
im currently using a different include code than the traditional <php include ('file') ?> command ....

Code: Select all

<? 
	if(isset($_GET&#1111;'id']) && $_GET&#1111;'id'] != "")&#123;
		$id= $_GET&#1111;'id'];
	&#125;else&#123;
		$id= "";
	&#125;
	
	if($id=="")&#123;
		include('../cgi-bin/cutenews/show_news.php');
	&#125;else&#123;
		$include= $_GET&#1111;'id'];
		include("$include.php");
	&#125;
?>
i have this member posting site where i can add delete and modify the members page, but when i try to use this include to execute those commands, the add will show in the website but the rest wont...and all of them dont do what they are supposed to do....for example delete doesnt delete add goes to the add page but doesnt add members,... here is the code for the 3 links

Code: Select all

echo "<br> <a href=roster.php?action=delete&id=$key>Delete</a>\n";
    echo "<a href=roster.php?action=edit&id=$key>Edit</a>\n";
    echo "<a href=addmem.php>Add</a>\n";
any help would be greatly appreciated

Posted: Wed Jul 16, 2003 1:41 am
by Tubbietoeter
first of all,
echo "<a href=roster.php?action=edit&id=".$key.">Edit</a>\n";
would be better

then, this:
$include= $_GET['id'];
include("$include.php");
might be problematic too. change it to:
include($id.".php");



maybe that was it. never print variables directly into strings, always concatenate