Help - Search - Members - Calendar
Full Version: Activate Php Script From Button Or Anchor
Zymic Webmaster Forums > Web Design & Development > Server Side Scripting > PHP
kevin_k
Hi All:

I have just gotten a web comic project and I want the user to be able to step through the various pages of the comic with buttons for FIRST, PREV, NEXT and LAST. I've thought about using graphics for the buttons or using the HTML "button" statement. My question is how do I activate my PHP script which navigates the user through the MySQL database? Do I use "OnClick?" What would be the format of the statement? I've seen other sites do this so I know it is possible, I'm just not sure where to begin.

The way I thought I would use MySQL is to hold the file names of the comic pages which when you select a button would fetch the appropriate page from the table. It would then be a simple matter to display the comic on the web page. Also, other data is pulled from the database; for each comic page there are comments associated with it.

Any suggestions would be greatly appreciated. Thanks in advance.
kevin_k
Hi Everyone:

Well, the solution came to me a short time after I posted the topic. I use a standard anchor and query string to trigger the script, like this:

CODE
<a href="foo.php?action=next"><img src="images/next.png"
width="21" height="20" border="0" title="next" alt="next"></a>


The rest of the buttons follow the same format. The script uses a switch statement to determine what action to take, one case statement per button. It was so simple I just didn't think of it. Now I just need to put the database code in to complete the project. Certainly there are more steps involved but this was what was puzzling me.
zpcs
Hi kevin_k,
It's pretty cool when the light comes on, Wish I could've been there to see the look of "Oh Wow!" in your acheivement. Good going using the ol' noggin.

zpcs
kevin_k
QUOTE(zpcs @ Jul 6 2009, 07:42 PM) *
Hi kevin_k,
It's pretty cool when the light comes on, Wish I could've been there to see the look of "Oh Wow!" in your acheivement. Good going using the ol' noggin.




Yeah, thanks -- I feel pretty silly but it proves that no matter what, a person should go ahead and simply ask their question on the forums. Usually, someone will answer quickly and help you out of what, at the time, seems like the hardest problem ever. Even if you do figure your problem out first someone else may benefit from the information. Thanks for the comment.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.