how to call a function when somebody click a link?



i want to creat a link
when somebody click the link
the php script calls a function,then display itself :)

i have tried
<a href=<? funtion(); echo=$_server['php_self'] ?>text</a>
but it will call the function whether i click the link


then i tried this (using forms)
<form action="<?php function(); echo "<script>"; echo
"window.location.href=$_SERVER['PHP_SELF']"; echo '</script>';?>">
<input type="submit" value="text" /></form>
but it didnot work either.
my browser said there were parse errors,T_STRING expected or
something....:(


now i am thinking using a flag,say,$functioncall,
href=$_server[request_url]&functioncall=1
then if functioncall==1,call that function
but is it right?
is there some way simple to do that?


any suggestion is appreciated :)

.



Relevant Pages

  • Re: Can this be done with PHP?
    ... would display and part B would not run and the php script would terminate. ... With a bit of modification you could cope with error messages ...
    (comp.lang.php)
  • Regular Expression Wildcard
    ... PHP script that would read the file, display it in the browser for me. ... to remove the date entry (just from the display, not the logs). ... retaining the end-of-line and I get a new line in the source code. ...
    (comp.lang.php)
  • Re: Display a friends name when searched for by phone number
    ... u need to find out how many line (array), and use a FOR to explode them into ... > I am wanting this PHP script to seach through a small phonebook file and ... > Would display: ...
    (alt.php)
  • XML HTTP GET does not seem to work in IE6 when used with setTimeout
    ... I am trying to get the output of a php script to be displayed on a page ... var xmlhttp; ... Time will display here!! ... Script Debugger, the value of xmlhttp.responseText does not get ...
    (comp.lang.javascript)
  • Re: include a file with parameters
    ... Appending variables onto the URL is a method of sending variables across ... change arg to equal anything and it will display on the page. ... This opens your PHP script up to manipulation. ...
    (comp.lang.php)