Jump to content

[SOLVED] include problem


StefanRSA

Recommended Posts

I have my root folder as:

$root = $_SERVER["SITE_HTMLROOT"];  // the server root

 

Why does this not work when I want to include a php file:

include "$root/form.php";

 

But the link to an image work like:

<img src="<?echo $root;?>/images/pic1.gif">

on the same form???

Link to comment
https://forums.phpfreaks.com/topic/180955-solved-include-problem/
Share on other sites

well see with http_host is work include the the http://

so if your url is http://www.google.com/test.php

http_host will return www.google.com

i know that with include you can just do something like this

include "form.php";

or if its higher up

include "include/form.php";

here is why

$_SERVER["SITE_HTMLROOT"]; 

doesnt actually exist.

if you add

error_reporting(E_ALL);

You will see it throws an error so when you did this.

include $root.'newadfield.php';

$root was not set so it was the same thing as

include 'newadfield.php';

which is why I said to leave $root out..

 

Make sense?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.