ninjablade15 Posted June 29, 2007 Share Posted June 29, 2007 Hi I'm new to PHP and I'm trying to test if information has been _posted for use of $_REQUEST, attached is the source file (just got to turn it to .php to test). It works fine but when you first load the page since no information is posted yet I get PHP Notice: Undefined index: year in C:\Inetpub\wwwroot\calender.php on line 12 PHP Notice: Undefined index: day in C:\Inetpub\wwwroot\calender.php on line 13 PHP Notice: Undefined index: month in C:\Inetpub\wwwroot\calender.php on line 14 PHP Notice: Undefined index: year in C:\Inetpub\wwwroot\calender.php on line 48 what would the if() condition be to check if there is information posted for it to $_REQUEST Once I click the submit button it is fine cause I have them _POSTed information. Link to comment https://forums.phpfreaks.com/topic/57771-solved-checking-if-info-is-posted/ Share on other sites More sharing options...
per1os Posted June 29, 2007 Share Posted June 29, 2007 Some code works but doing this would solve the problem: $year = isset($_REQUEST['year'])?$_REQUEST['year']:''; Checks if the variable was set if it was it assigns it to year if not is assings '' to year to avoid a notice error. Link to comment https://forums.phpfreaks.com/topic/57771-solved-checking-if-info-is-posted/#findComment-286115 Share on other sites More sharing options...
ninjablade15 Posted June 29, 2007 Author Share Posted June 29, 2007 Awesome thank you! Link to comment https://forums.phpfreaks.com/topic/57771-solved-checking-if-info-is-posted/#findComment-286124 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.