Hi there
I am new to php - but getting on well with it.
My script below works when I test locally - but not when I go live.
I have a function to fill a dropdown box with data from a database.
I pass a connection and a PEAR .tpl file object to the function.
The function uses the two and adds the necessary dropdown details for output.
It all works locally.
It will not work this way when it goes live.
As a test I stripped out the functions and put their code in-line where they were required.
This worked. It suggests to me that I cant pass a template object to a function and get the result I need in the live setting.
My host uses: PHP Version 4.3.11
I use PHP Version 5.0.4 locally.
Is php 5 letting me away with something it shouldn't?
How can I make this work for my live environment?
Any Help much appreciated.
Thanks
Bullit
<?php
.
.
.
function filldropdownbox($connection, $template){
//sql to get the headings to fill
$template->setCurrentBlock("USERENTRY");
//for each result build an option value and row pairing
while ($deptrow = mysql_fetch_array($SQLresult))
{
$optionvalue = $deptrow["dept_id"];
$optionrow = $deptrow["deptname"];
$template->setCurrentBlock("DEPTINPUT");
$template->setVariable("OPTIONVALUE",$optionvalue);
$template->setVariable("OPTIONROW",$optionrow);
$template->parseCurrentBlock();
} //endwhile
$template->parseCurrentBlock();
}//end func loaddeptdropdown
//connect to server
//select database
$template = new HTML_Template_ITX("./templates");
$template->loadTemplatefile("enterusers.tpl", true, true);
//call the function
loaddeptdropdown($connection, $template);
//call more dropdown box filling functions
//then finally
$template->show();
?>