views:

33

answers:

3

I have a problem with my index.php, i have this small script that decides what content to deliver

        <?php $clase = $_GET['clase'];
if ($clase == empresa) {include ("empresa.php");}
elseif ($clase == productos) {include("productos.php");}
else {include ($_SERVER['DOCUMENT_ROOT']."/inicio.html"); }
?>

it works when i go to www.mysite.com/index.php

but when i go to www.mysite.com it doesnt and i cant just figure our why.

+1  A: 

You are missing quotes around empresa and productos:

<?php $clase = $_GET['clase'];
if ($clase == 'empresa') {include ("empresa.php");}
elseif ($clase == 'productos') {include("productos.php");}
else {include ($_SERVER['DOCUMENT_ROOT']."/inicio.html"); }
?>
Sarfraz
I was about to write that as well.
mingos
Ding! Ding! Me too. funny
Gutzofter
+1  A: 

Check the include path on your server to ensure that include() can locate empresa.php and productos.php

Mark Baker
+1  A: 

Need to set your server up to recognize default index's.

I use Apache and in the httpd.conf file you would want to change the DirectoryIndex.

Here is my copy:

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.htm index.html
</IfModule>
Gutzofter
thx for the help, it was finally a problem in the httpd.conf. that didn't have index.php as the predetermined index.
diego