I didnt go through your script... but in order to call a php function... it MUST be in php tags... so if you are doing html...
Code:
<html>
<title>Inside HTML</title>
<body>
<p>I need to call a function... Here it is...</p>
<p><? $blah = php_function(); echo"$blah"; ?>
</body>
</html>
Do ya get it? it has to be called within the <? and ?> tags...
Hm, that is not the problem, I think. You cannot call PHP functions like that. The undefined error is Javascript. It attempts to execute a function onclick. "selvam" isn't a function. That's why you're getting the error. If you tell us what exactly you want to do we might can help a bit more.
PHP is on the server, and Javascript is on your computer. You cannot trigger PHP functions without submitting data to the server. You can do something like that:
Just to be on the safe side as well I recommend using <?php ?> tags and not short tags <? ?> because those are used by XML and other languages and can confilict.
Secondly if you just wanted to echo 'selvam' you could use javascript below.