[thelist] one more PHP question - using a function

Darrell King darrellgking at gmail.com
Mon Oct 15 11:52:14 CDT 2007


You can us output buffering around the function call
(http://us.php.net/manual/en/function.ob-start.php) or you can just
assign the output to a variable and then echo that variable when
appropriate.

D

On 10/15/07, Tom Dell'Aringa <pixelmech at gmail.com> wrote:
> Thanks for all the answers folks, really helpful. One more question. I want
> to use a function to call the data when the user clicks a link. If I don't I
> end up with errors because code is just running willy nilly in the page.
>
> So I have this example function
>
> function GetRaceinfo($raceId)
> {
>     // make sure there is a race id selected before attempting to pull data
>     if(isset($raceId))
>     {
>     ...do some stuff, etc....
>     }
> }
>
> Then I have the link that is being written out like so:
>
> <a href=\'events.php?id=\'' . $info['id'] . '>' . $info['name'] . '</a>
>
> How can I switch this so when the link is clicked, it still calls
> events.php?id=
> but it does it via the function instead? Would I just do this:
>
> <a href='<?php GetRaceinfo(' . $raceId .  ')?>'>linkname</a>
>
> then at the end of my function use header to hit the page?
>
> header('Location: http://blah.com/events.php?id=4');
>
> I'm thinking I've got something backwards here though...
>
> CC me at pixelmech at gee mail dot com if you can...thanks!
>
> Tom
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>


-- 
Darrell G. King
DarrellGKing at gmail.com
(C) 1/585.820.8231



More information about the thelist mailing list