Jump to content

[SOLVED] href to permform a function


tet3828

Recommended Posts

Yep. But not the way I think you're thinking about it. Usually when I have to do things like this, I use:[code]<a href='example.php?action=update&id=12'>Click Here</a>[/code] But you're going to have to build the links into the page with php like so:
[code]while($res->fetchInto($row)) // Read rows from PEAR DB call
{
  echo '<a href=\'example.php?action=update&id='.$row[0].'\'>'.$row[1].'</a>';
}[/code]
Where $row[0] is your id from the database, and $row[1] is a title or name or whatever. Corresponding to a SQL something like:[code]SELECT id, title FROM mytable[/code]

Then in your example.php script, you can process that info however you want, and throw a header redirect at the end to take you back to the page that submitted it or wherever else you want to go.
[code]header("Location: formfillout.php");[/code]

Actually now that I think about it, you could have all the code that handles the updates or whatever on the same page, just using the same page in the 'a href'. In that case I'd clear the $_GET variables after processing them before proceeding with the rest of the code so that you don't get weird errors with page refreshes.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.