I am witting a project that needs to have unique names for each detail
line. To achieve this I use the day and line number as part of the
name. Given my code I would expect that I would get something like
<label for='hrs'>Hours<input type='text' name='hrs1_1' style='width:2em'
/></label>. My result is <label for='hrs'>Hours<input type='text'
name='hrs_' style='width:2em' /></label> as you can see the name
attribute does not have the variable portion. I can see that the
parameters passed are comming in to the constructor correctly but the
member variables of my class are not being set. I can't see why, it
must be something real simple.
I have declared the class as follows:
class clsBlnkDetail
{
var $mTs;
var $mDay;
var $mLine;
function clsBlnkDetail($Day,$Line,$sheet="none")
{
//Debug code
$fp=fopen("debug.txt","w");
//End Debug code
if ($sheet != "none")
{
if($day > 6)
{
echo "There are only 7 days in a week";
return(0);
}
//member variable should be set here
$this->mDay=$Day;
$this->mLine=$Line;
$this->mTs=$sheet;
//Debug code
fwrite($fp,$this->$mDay." ".$this->$mLine);
fclose($fp);
//End Debugg code
}
}
function MkName()
{
return($this->mDay."_".$this->mLine);
}
function Build()
{
//echo "Blank detail line<br />";
echo "<label for='hrs'>Hours";
$widgitName="hrs".$this->MKName();
echo "<input type='text' name='$widgitName; style='width:2em' />";
echo"</label> <br />";
}
}