I've got a slight bug in my codes.. What I would like to do is:
1) retrieve from database (basically I stored numbers -- 0 and 1, 2 etc for an adminstatus)
2) display it in the textbox for editing..
I've managed to do both.. But if the number retrieved from the database is a 0, it will not be displayed in my textbox, it displays other numbers except 0.
Does anyone know why? or have any ideas to get around it?
Really apprieciate any help given..
Here's how I did it:
Code: Select all
<?php
// textbox in the form
html_text("form[accessLevel]",$row[accessLevel],'','',"formEle");
// function to display the textbox
function html_text($name, $value='', $size='', $maxlength='', $class='')
{
print '<input type="text" name="'.$name.'"';
if($value){print ' value="'.$value.'"';}
if($size){print ' size="'.$size.'"';}
if($maxlength){print ' maxlength="'.$maxlength.'"';}
if($class){print ' class="'.$class.'"';}
print '>';
}
?>