HoTDaWg Posted April 23, 2007 Share Posted April 23, 2007 what would you say is the best method for stating the current file. what i mean is, take a look at this: <?php echo '<a href='.$_SERVER['PHP_SELF'].'/index.php'; ?> instead of typing in the url, or having to type in php self i heard about ... which makes stating the current file a lot easier. Could someone please explain or point me to a tutorial? thanks. also, take a look at this script <?php error_reporting(E_ALL); $underconstruction = rand(0,3099); $status = rand(0,3099); $contactus = rand(0,3099); $mode = $_GET['mode']; switch ($mode){ case "$underconstruction": echo "Appologies, our website is currently under construction. /n"; break; case "$status": echo "currently, this website is approximately 5% percent complete"; break; case "$contactus": echo "The contact us form shall be up momentarily. Thank you for your patience."; break; default: echo "Appologies, our website is currently under construction. /n"; break; } ?> when not set on error reporting, no errors show up. But when it is set it echos this error: Notice: Undefined index: mode in /home/slicksil/public_html/index.php on line 7 what is the best method to avoid this error? thanks for any help possible .-=!X!=-. Quote Link to comment Share on other sites More sharing options...
benjaminbeazy Posted April 23, 2007 Share Posted April 23, 2007 mode has to be set, if the url doesn't contain ?mode= in it, this error will come up, as i understand it to fix it, check that mode is set like this.. <?php if (isset ($_GET['mode'])) { $mode = $_GET['mode']; } else { $mode = 1; //set some default value that isn't defined in your switch } ?> i guess i don't really understand your first question.. what are you looking for? Quote Link to comment Share on other sites More sharing options...
HoTDaWg Posted April 23, 2007 Author Share Posted April 23, 2007 thank you for your response. for example, during phpbb scripts or ,"pro scripts" lol i find it intriguing how the website address is still fully functional when the use "..." my question is what does the "..." do in php? thanks .-=!X!=-. Quote Link to comment Share on other sites More sharing options...
benjaminbeazy Posted April 23, 2007 Share Posted April 23, 2007 without seeing an example, i would have to say that that isn't php related. you would modify your .htaccess file to something like this RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?route=$1 [L,QSA] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.