Jump to content


Photo

Include() function no longer working


  • Please log in to reply
2 replies to this topic

#1 antray

antray
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 05 June 2006 - 06:43 PM

I am currently testing a php form on a new server, which hasn't gone public yet. I am working on a vurtual server. One form, floor estimation form, is supposed to carry a variable from a link to load color selection. The code is below:

       <?php    
    include "".$color.".php";
         ?>    

Link to the problem form: [a href=\"http://gndzero.com/form-test/flooring-estimation-new.php?item=DuroStat%20Tile&color=dscolor\" target=\"_blank\"]http://gndzero.com/form-test/flooring-esti...e&color=dscolor[/a]

I tested it on my host and it worked fine, so I wonder if its a php version issue. [a href=\"http://www.gndzero.com/flooring_estimation.php?item=DuroStat_Tile&color=dscolor\" target=\"_blank\"]Here's what it should look like when the colors load.[/a]

The php version of the new server is 4.4.2-1-1b1
The one I tested it on, my host, is: 4.4.1 - it works on this one!!

Where should I start on this issue?

#2 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 05 June 2006 - 09:22 PM

I suspect that register_globals is turned off on the other host. Which is why the value of $color is not being recognized. If the value is being passed via the url...then do this:

$color = $_GET[colorvalue];

include $color.'.php';

If it's being submitted via a form, then do this:


$color = $_POST[colorvalue];

include $color.'.php';

Hope that help. Good luck.
PHP Ninja

#3 joecooper

joecooper
  • Members
  • PipPipPip
  • Advanced Member
  • 358 posts

Posted 05 June 2006 - 11:58 PM

or an eaiser way

include "$color.php";
Signature:
[/a]
[a href="http://www.planet-so...=1999&lngWId=8" target="_blank"]EzLogin 1.0[/a]
[a href="http://www.essexracers.com" target="_blank"]Essexracers.com[/a]
Msn Messenger: joe@joeyjoe.co.uk




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users