Jump to content

PHP Forms Help.


clanstyles

Recommended Posts

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";	
	}

Link to comment
https://forums.phpfreaks.com/topic/73412-php-forms-help/
Share on other sites

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";	
	}

Link to comment
https://forums.phpfreaks.com/topic/73412-php-forms-help/#findComment-370368
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.