hass1980 Posted April 16, 2009 Share Posted April 16, 2009 Hi im getting this error on my web page: Notice: Undefined index: id in C:\wamp\www\chapter25\show_cat.php on line 6 <?php include ('book_sc_fns.php'); // The shopping cart needs sessions, so start one session_start(); $catid = $_GET['id']; $name = get_category_name($catid); do_html_header($name); // get the book info out from db $book_array = get_books($catid); display_books($book_array); // if logged in as admin, show add, delete book links if(isset($HTTP_SESSION_VARS['admin_user'])) { display_button('index.php', 'continue', 'Continue Shopping'); display_button('admin.php', 'admin-menu', 'Admin Menu'); display_button("edit_category_form.php?catid=$catid", 'edit-category', 'Edit Category'); } else display_button('index.php', 'continue-shopping', 'Continue Shopping'); do_html_footer(); ?> Link to comment https://forums.phpfreaks.com/topic/154400-undefined-index/ Share on other sites More sharing options...
Maq Posted April 16, 2009 Share Posted April 16, 2009 You have to check to see if it exists first. $catid = isset($_GET['id']) ? $_GET['id'] : null; Link to comment https://forums.phpfreaks.com/topic/154400-undefined-index/#findComment-811832 Share on other sites More sharing options...
The Little Guy Posted April 16, 2009 Share Posted April 16, 2009 you have strict formatting on, you would have to do this: if(isset($_GET['id'])){ $catid = $_GET['id']; }else{ $catid = ''; } Link to comment https://forums.phpfreaks.com/topic/154400-undefined-index/#findComment-811835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.