skter4938 Posted March 24, 2007 Share Posted March 24, 2007 Hello. I have this question that I cannot possibly get working. Alright, let me explain. I have a button which is called "bookmark". When that button is clicked, it goes to a page called "bookmark.php" and then executes a peice of code which adds that file to you bookmarks. Now what I want to do is have a image named "bookmark" which will be a little '+' sign. When that image is clicked, the bookmark.php code is executed BUT WITHOUT CHANGING THE PAGE. aka using Ajax. and if that file has already been bookmarked the image will be a little '-' sign. So here is my bookmark.php code: <? require_once("include/main.php"); dbconn(); loggedinorreturn(); function bark($msg) { stdhead(); stdmsg("w00t!", $msg); stdfoot(); exit; } if (!isset($_GET[file])) bark ("Faild ... No file selected"); if ((get_row_count("bookmarks", "WHERE userid=$CURUSER[id] AND fileid = $_GET[file]")) > 0) bark("Already bookmarked $_GET[file]"); mysql_query("INSERT INTO bookmarks (userid, fileid) VALUES ($CURUSER[id], $_GET[file])") or sqlerr(__FILE__,__LINE__); bark ("Successfully bookmarked"); ?> and here is the image of the way it goes to the boomark.php page. the little + sign is the bookmark.php button thing, and the arrow is the download button. -Artem Link to comment https://forums.phpfreaks.com/topic/44145-implement-php-code-into-ajax/ Share on other sites More sharing options...
skter4938 Posted March 28, 2007 Author Share Posted March 28, 2007 Anyone? Link to comment https://forums.phpfreaks.com/topic/44145-implement-php-code-into-ajax/#findComment-216951 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.