post - "Index.php?webpage" Not Functioning properly -
post - "Index.php?webpage" Not Functioning properly -
so trying access webpage within site.
in index, utilize isset($_get() parameter access page. code index.php follows:
<!doctype html> <html> <head> <?php require ("includes/database.php"); ?> <title>offstreams admin panel</title> <link rel="stylesheet" type="text/css" href="styles/admin_body.css" /> <link rel="stylesheet" type="text/css" href="styles/admin_header.css" /> <link rel="stylesheet" type="text/css" href="styles/admin_footer.css" /> <link rel="stylesheet" type="text/css" href="styles/admin_postspace.css" /> </head> <body> <header> <!--header info here --> </header> <div class="wrapper"> <div class="sidebar"> <ul> <li><a href="index.php?post_new_band">post new band</a></li> </ul> </div> <article> <?php if (isset($_get['post_new_band'])){ require ("includes/post_new_band.php"); echo "page accessed"; } else { echo "page not accessible."; } ?> </article> </div> </body> </html>
i have echo page not available when "index.php?page" doesn't exist. when exist, such "index.php?post_new_band" (code below) nil posted. sever , database work, sure. mysql isn't problem since trying html work.
code "post_new_band.php":
<!doctype html> <html> <head> <!-- head info goes here --> </head> <body> <h1>insert new band</h1> <form action='index.php?post_new_band' method='post'> <b>insert new band</b><input type='text' name='band_name' /> <b>insert band origin</b><input type='text' name='band_origin' /> <input type='submit' name='insert_band' value='add band' /> </form> <?php if (isset($_post['post_new_band'])){ $band_name = $_post['band_name']; if($band_name==''){ echo "<script>alert ('please insert band name')</script>"; echo "<script>window.open('index.php?post_new_band','_self')</script>" } else { $insert_band_name = "insert band (band_name) values ('$band_name')"; $run_band_name = mysql_query("$insert_band_name"); echo "<script>alert ('new category added')</script>"; echo "<script>window.open('index.php?post_new_band','_self')</script>" } } ?> </body> </html>
you can utilize request key 1 time - dont utilize $_get['post_new_band']
, $_post['post_new_band']
in same request. alter 1 of keys.
php post get isset
Comments
Post a Comment