user defined function: TextBox()
| From: | Prince | Date: | Mon, 14 Apr 2003 21:36:42 +0000 |
| Subject: | user defined function: TextBox() | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-143839@lists.php.net to get a copy of this message | ||
hi..
i have a function called TextBox() and its supposed to be used in a form..
function TextBox($label, $name, $value, $maxsize, $size){
echo "$label <input type=text name=$name>";
}
it is used like this:
TextBox("Email", "email", ...);
1. how would i make this function into a variable arguement list function..
i want it to take any number of variables or arguements
2. giving this function can take any number of arguements how would you tell
the function to ignore any variables in the function body to be ignored if
not used.. i.e. if i have $label and $name used:
TextBox("Email", "email");
then how would i have $size $maxsize $value and so on ignored but the
function work the way its supposed to work...?
overall how would the best way to write this be since i wont know how many
arguements a person will want to use but using at least the required min
and that would be $name
also was considering overloading it to mean also a textarea but dont think
thats possible...
if possible how would i do that?
tnx