Jump to content

$_GET array returns empty value


shwetapandit

Recommended Posts

whwn i tried to print $_GET array it does not print anything while i am sending p_id through URL.Why it is so......

 

 

<?php
$conn=mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db("regis")or die(mysql_error());

$query=mysql_query("SELECT * FROM admin_page")or die(mysql_error());
//$row=mysql_fetch_array($query);

echo "<table width='500' cellspacing='0' cellpadding='0' border='0'>";
echo "<tr align='centre' colspan='1' rowspan='1'><th>p_name</th><th>p_link</th><th>p_content</th></tr>";
while($row=mysql_fetch_array($query)){
$p_id=$row['p_id'];
echo "<tr><td>";
$link=$row['p_name'];

print "<a href=".'show_page.php?p_id=$p_id'.">" .$row['p_name'] . "</a><br>";
          

echo "</td><td>";
echo $row['p_link'];
echo "</td></tr>";

}
echo "<tr><td>";
echo "</table>";
print_r($_GET);
?>

Link to comment
https://forums.phpfreaks.com/topic/284276-_get-array-returns-empty-value/
Share on other sites

 

<?php

$conn = mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("regis") or die(mysql_error());

$query = "SELECT * FROM admin_page";
$result = mysql_query($query) or die(mysql_error());

echo "<table width='500' cellspacing='0' cellpadding='0' border='0'>\n";
echo "<tr align='center' colspan='1' rowspan='1'>\n";
echo "<th>p_name</th><th>p_link</th><th>p_content</th>\n"
echo "</tr>";
while($row = mysql_fetch_assoc($result))
{
    echo "<tr>\n";
    echo "<td><a href='show_page.php?p_id={$row['p_id']}'>{$row['p_name']}</a></td>\n";
    echo "<td>{$row['p_link']}</td>\n";
    echo "</tr>\n";
}
echo "</table>\n";

echo "<pre>" . print_r($_GET, 1) . "</pre>";
?>
<?php

$conn = mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("regis") or die(mysql_error());

$query = "SELECT * FROM admin_page";
$result = mysql_query($query) or die(mysql_error());

echo "<table width='500' cellspacing='0' cellpadding='0' border='0'>\n";
echo "<tr align='center' colspan='1' rowspan='1'>\n";
echo "<th>p_name</th><th>p_link</th><th>p_content</th>\n"
echo "</tr>";
while($row = mysql_fetch_assoc($result))
{
    echo "<tr>\n";
    echo "<td><a href='show_page.php?p_id={$row['p_id']}'>{$row['p_name']}</a></td>\n";
    echo "<td>{$row['p_link']}</td>\n";
    echo "</tr>\n";
}
echo "</table>\n";

echo "<pre>" . print_r($_GET, 1) . "</pre>";
?>

thanks a lot....it works now.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.