csckid Posted March 20, 2009 Share Posted March 20, 2009 <form > Search By Country:<br> <select name="country" onClick="<?php hello(); ?>"> <option value="Australia">Australia</option> <option value="USA">USA</option> </select> </form> <div name="display"> <?php echo "<table border=3><tr><td>hi</td></tr></table>"; function hello(){ echo "how"; } ?> </div> i tried to call the phpfuntion hello() onclick.... but the command is not executed....... plz help Link to comment https://forums.phpfreaks.com/topic/150273-calling-php-function/ Share on other sites More sharing options...
redarrow Posted March 20, 2009 Share Posted March 20, 2009 <?php echo hello(); ?> Link to comment https://forums.phpfreaks.com/topic/150273-calling-php-function/#findComment-789167 Share on other sites More sharing options...
ratcateme Posted March 20, 2009 Share Posted March 20, 2009 ok well i am guessing you are new to web development basically PHP is Server-Side so everything happens on the server then the page is sent to the user and PHP stooped and not called again until a new URL is clicked also when it is started again it is completely fresh starting with a new script. you need to use Javascript it is Client-Side and so happens int the clients Web Browser. it can be used for things you want to happen when user clicks a button Scott. Link to comment https://forums.phpfreaks.com/topic/150273-calling-php-function/#findComment-789168 Share on other sites More sharing options...
ratcateme Posted March 20, 2009 Share Posted March 20, 2009 <?php echo hello(); ?> would do nothing also as there is no "return" in the function it echos everything Scott. Link to comment https://forums.phpfreaks.com/topic/150273-calling-php-function/#findComment-789169 Share on other sites More sharing options...
redarrow Posted March 20, 2009 Share Posted March 20, 2009 i did not no that op never had JavaScript implemented did i so sorry. Link to comment https://forums.phpfreaks.com/topic/150273-calling-php-function/#findComment-789172 Share on other sites More sharing options...
trq Posted March 20, 2009 Share Posted March 20, 2009 i did not no that op never had JavaScript implemented did i so sorry. You should also read ratcateme's first reply. Your solution will never work, you seem to be missing the basics of server / client interaction. Link to comment https://forums.phpfreaks.com/topic/150273-calling-php-function/#findComment-789187 Share on other sites More sharing options...
redarrow Posted March 20, 2009 Share Posted March 20, 2009 Agree i am sorry, just dash d in there , like i said years ago, i hate JavaScript sorry. I did study JavaScript, and got a cert, but i was told to study java and continue what i new, never did like php to much . i have noticed if you don't no JavaScript and ajax there no jobs for me. Link to comment https://forums.phpfreaks.com/topic/150273-calling-php-function/#findComment-789227 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.