Lodius2000 Posted January 20, 2009 Share Posted January 20, 2009 blarg Im drawing a major blank in defining this function I want $size to be an optional value, it doesn't need to be there, and if it isnt there then html makes a default sized text input, if it is there is makes a text input at the size that is placed there, but when i call the function using input_text('name', $_POST); i am getting a warning:Missing argument 3 for input_text() <?php function input_text($element_name, $values, $size){ print '<input type="text" name="' . $element_name .'" value="'; print htmlentities($values[$element_name]) . '"'; if(isset($size)){ print 'size="'.$size.'"'; } print ' />'; } ?> I tried putting an else{ print "";} but that didnt work so how do I make argument 3 optional Thanks Link to comment https://forums.phpfreaks.com/topic/141556-solved-function-creation-help/ Share on other sites More sharing options...
Philip Posted January 20, 2009 Share Posted January 20, 2009 input_text($element_name, $values, $size) to input_text($element_name, $values, $size=''){ Link to comment https://forums.phpfreaks.com/topic/141556-solved-function-creation-help/#findComment-740939 Share on other sites More sharing options...
Lodius2000 Posted January 20, 2009 Author Share Posted January 20, 2009 KingPhilip, you are awesome // i knew it was something simple thanks a lot Link to comment https://forums.phpfreaks.com/topic/141556-solved-function-creation-help/#findComment-740941 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.