lonewolf217 Posted June 23, 2008 Share Posted June 23, 2008 I have a php page that displays data from a database. there is an option on the page to delete a row. If the user chooses to delete the row, he goes to the delete.php page which will process the delete, then redirect back to the original page. My issue is with a piece of code on this main page where I do this $query = $_GET['name']; if(strlen($query) != 0) { $query = str_replace(' ','%20',$query); echo "<br>The file " . $query . " was successfully uploaded.<br><br>"; } if i am loading this page without having deleted the file, the $_GET should be empty, but I am getting an error PHP Notice: Undefined index: name in view.php how do I change it so that if the querystring really is empty, it will not do anything here and continue with the rest of the code Link to comment https://forums.phpfreaks.com/topic/111516-solved-how-to-check-for-empty-querystring-in-php/ Share on other sites More sharing options...
trq Posted June 23, 2008 Share Posted June 23, 2008 if(isset($_GET['name']) { $query = $_GET['name']; $query = str_replace(' ','%20',$query); echo "<br>The file " . $query . " was successfully uploaded.<br><br>"; } Link to comment https://forums.phpfreaks.com/topic/111516-solved-how-to-check-for-empty-querystring-in-php/#findComment-572327 Share on other sites More sharing options...
lonewolf217 Posted June 23, 2008 Author Share Posted June 23, 2008 thanks again! Link to comment https://forums.phpfreaks.com/topic/111516-solved-how-to-check-for-empty-querystring-in-php/#findComment-572332 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.