Hi
I want that when the user clicks on hi function showProjects should be called. How can I do this??
<a href="???" >hi</a>
function showProject($projectName)
{
.....
}
Hi
I want that when the user clicks on hi function showProjects should be called. How can I do this??
<a href="???" >hi</a>
function showProject($projectName)
{
.....
}
Assuming that the HTML and PHP function reside in the same file:
<?php
echo "<a href=\"".$_SERVER['PHP_SELF']."?clicked=1\">Hi</a>";
if(isset($_GET['clicked'])){
showProject();
}
function showProject(){
...
}
?>
Eh? You can define your functions wherever you want. PHP interprets the file before trying to execute it.
I stand corrected shrike... I went back through my notes on functions from a couple of years ago, and you are right...
I misinterpreted one of my notes, and the thought process was to always define it before the call, out of good practice which translated to defining variables before calling them... It's one of those "ways I standardize my code... always define everything before trying to call it, (arrays, variables, functions) because sometimes you have to, sometimes you don't, and this way, you never have to worry about it..."