php - Action Variable not accepted -
i have used code million times before i'm having problems.
in top.php file have put code http://www.sentuamsg.com/index.php?action=about
now when reach index page error code of notice: undefined variable: action in /home/content/90/9753290/html/index.php on line 4
<?php include("top.php"); if($action == "") { echo "<p align=center><img src=mondaymoan.jpg></img></p>"; echo "<p><font face=tahoma><b><font size=2>monday moan:</font></b> <font size=2> weeks gaming action, rumours, news snipplets assessed , talked in 1 blog. have read of own on monday's moan</font></font></p>"; echo "<p align=right><font face=tahoma size=2>[read]</font></p>"; echo "<p><img src=mostloved.jpg></p>"; echo "<p align=center><img src=retrogamer.jpg></img></p>"; echo "<p><font face=tahoma><b><font size=2>retro gamer:</font></b> <font size=2> taking on games past, these games range video game consoles pc games. 1 of our popular feature gamers relive past through joys , frustrations.</font></font></p>"; echo "<p align=right><font face=tahoma size=2>[view]</font></p>"; include("bottom.php"); exit; } if($action == "action") { echo "done"; include("bottom.php"); exit; } ?>
why error happening? missing or using old coding techniques isn't used in php5?
that's because haven't set $action
before trying use it. following line of code needs go above if($action == "") {
statement:
$action = $_get['action'];
or, better yet, should check see if exists first:
$action = (isset($_get['action'])) ? $_get['action'] : '';
Comments
Post a Comment