nofel
September 11, 2011, 4:11pm
1
if folks, i m creating a page for some expermintal purpose and i m trying to echo value of url clicked but it isn’t echoing. i tried the mysql_error() in if statement but that too doesn’t show up. what am i missing?
if(isset($_GET['page'])){
$sel_page = $_GET['page'];
if(!isset($_GET['page'])){
echo mysql_error();
}
}else{
$sel_page = $_GET['page'] = "";
}
here is the link
echo "<a href=\\"content.php?page =" . urlencode($row["id"]). "\\"><li>{$row["menu_name"]}</a></li>"
and here is the get echo
echo "$sel_page";
nofel
September 11, 2011, 4:53pm
2
now it says page not found, here is the full page code
<?php require("includes/functions.php"); ?>
<?php
if(isset($_GET['page'])){
echo $_GET['page'];
}else{
echo "Page not found";
}
?>
<body>
<div class="container">
<div class="sidebar1">
<?php
$con = mysql_connect("localhost","root","");
confirm($con);
$seldb = mysql_select_db("sandbox");
confirm($seldb);
//$query = "select * from subjects";
//$subject_set = mysql_query($query);
$parent = get_subjects($subject);
?>
<ul>
<?php
while($subjects=mysql_fetch_array($parent))
{
echo "<a href=\\"\\"><li>{$subjects["menu_name"]}</a></li>";
$pageResult = get_pages($subjects["id"]);
echo "<ul class=\\"nested\\">";
while($row = mysql_fetch_array($pageResult)){
echo "<a href=\\"content.php?page =" . urlencode($row["id"]). "\\"><li>{$row["menu_name"]}</a></li>";
}
echo "</ul>";
}
?>
</ul>
</div>
<div class="content">
<h1>Here</h1>
<?php
echo ($sel_page);
?>
<!-- end .content --></div>
<!-- end .container --></div>
what am i missing?
nofel
September 11, 2011, 7:19pm
3
I figured out the reason i had space between page and =. But to my knowledge white spaces aren’t significant. then the error?
I am not seeing the whole code so I don’t why/where mysql_error() would come into play. Anyway I think you want this:
if( isset($_GET['page']) ) {
echo $_GET['page'];
} else {
echo 'Page not set';
}