php include
alrighty let me explain what I'm trying to do. I made an online form where a user can choose a month and a week then hit submit. The php page it POST's to turns the to variables into a string
$mon = $_POST[month]; $week = $_POST[week]; $getfile = $mon$week.php; include ($getfile); Pretty darn easy right? Well the problem is I don't know how to write a check function that makes sure the file exists before php tries to include it. Basically when the user enters a month and week that I don't have a file for I get a long php error message. I'd like to set it up so it just displays a message "Sorry we do not have a file for that month and week". Any help would be greatly appreciated. |
use file_exists($getfile);
so $mon = $_POST[month]; $week = $_POST[week]; $getfile = $mon$week.php; if(file_exists($getfile)){ include ($getfile); } else { echo "Error Message"; } |
awesome, thanks for the reply I'll try it first thing tomorrow morning!
|
All times are GMT -5. The time now is 09:23 PM. |