Re: Question about functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Methink you're a little confused. A function is a piece of code that
performs a specific job that can be called. You may send it
data, you may not. It may return data, it may not. If your link goes to
logout.php, that script may use functions to do it's job.
You can't call a function in a link as php is server-side. What you are
thinking of is an event handler, ie client side (javascript).

Example of how you could achieve what you want:

logout.php
========

include 'logfunctions.php'

logout($_GET['id']);

header("Location: index.php");
exit();

logfunctions.php
============

function logout($id) {
 unset($id);
}

etc etc etc - crude example but pushed for time and you get the idea!


On Jan 24, 2008 8:00 PM, Jason Pruim <japruim@xxxxxxxxxx> wrote:

> Hi everyone!
>
> So, I'm trying to learn about functions, and I think I understand what
> to use them for... And one of the ideas I had was to write a function
> to logout of an application. The question I have though, is how do I
> call it?
>
> Right now I just have a link like this: <A href="logout.php">Click
> here to logout</A>  Can I do the same thing with a function? And if
> so, then maybe I don't really understand functions like I thought I
> did... Because to me, that would look like it would be just the same
> as calling a single script to logout vs. a function?
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> japruim@xxxxxxxxxx
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux