[thelist] one more PHP question - using a function

Tom Dell'Aringa pixelmech at gmail.com
Mon Oct 15 11:14:30 CDT 2007


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



More information about the thelist mailing list