clanstyles Posted October 16, 2007 Share Posted October 16, 2007 Why doesn't this function work to generate an input field? ####################### # Create an Advanced # Textbox # function createTextBoxAdv($text, $name, $size, $onBlur, $onClick, $onFoc) { if(isset($onBlur)) $addThis += "onblur=".$onBlur." "; if(isset($onClick)) $addThis += "onclick=".$onClick." "; if(isset($onFoc)) $addThis += "onfocus=".$onFoc." "; echo $onFoc; print "<label>".$text."</label><input type=\"text\" size=\"".$size."\" name=\"".$name."\" ".$addThis." />\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/73412-php-forms-help/ Share on other sites More sharing options...
jd2007 Posted October 16, 2007 Share Posted October 16, 2007 when concatenating strings, don't use the + operator, use the dot (.) that's where u got it wrong . Quote Link to comment https://forums.phpfreaks.com/topic/73412-php-forms-help/#findComment-370345 Share on other sites More sharing options...
clanstyles Posted October 16, 2007 Author Share Posted October 16, 2007 Thanks but it stilld oesn't work. That did solve that one problem. But the OnClick="" ( Make Input Blank ). Starts with Username in teh textbox crap doesn't Quote Link to comment https://forums.phpfreaks.com/topic/73412-php-forms-help/#findComment-370365 Share on other sites More sharing options...
simcoweb Posted October 16, 2007 Share Posted October 16, 2007 Try this: ####################### # Create an Advanced # Textbox # function createTextBoxAdv($text, $name, $size, $onBlur, $onClick, $onFoc) { if(isset($onBlur)){ $addThis += "onblur=".$onBlur." "; } if(isset($onClick)){ $addThis += "onclick=".$onClick." "; } if(isset($onFoc)){ $addThis += "onfocus=".$onFoc." "; } echo $onFoc; print "<label>".$text."</label><input type=\"text\" size=\"".$size."\" name=\"".$name."\" ".$addThis." />\n"; } Quote Link to comment https://forums.phpfreaks.com/topic/73412-php-forms-help/#findComment-370368 Share on other sites More sharing options...
clanstyles Posted October 16, 2007 Author Share Posted October 16, 2007 noo like It does work. But, I am also trying to get it so that when you start the username box saids Username. OnClick it goes blank so you can type in your own username. Thank YOu Quote Link to comment https://forums.phpfreaks.com/topic/73412-php-forms-help/#findComment-370370 Share on other sites More sharing options...
kenrbnsn Posted October 16, 2007 Share Posted October 16, 2007 onClick, onBlur, etc. are Javascript, not PHP. PHP has no concept of what's on the screen or how the use is interacting with it. Ken Quote Link to comment https://forums.phpfreaks.com/topic/73412-php-forms-help/#findComment-370376 Share on other sites More sharing options...
simcoweb Posted October 16, 2007 Share Posted October 16, 2007 I don't understand. Can you clarify what you're looking for there? Quote Link to comment https://forums.phpfreaks.com/topic/73412-php-forms-help/#findComment-370377 Share on other sites More sharing options...
clanstyles Posted October 16, 2007 Author Share Posted October 16, 2007 Trying to generate per input box what kenrbnsn described. Quote Link to comment https://forums.phpfreaks.com/topic/73412-php-forms-help/#findComment-370399 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.