Search the Community
Showing results for tags 'user favorites'.
-
Hi All, I am wondering if you could provide input on the best way an item as a user favorite. I am setting up a price comaprison website, and have most of the logic done for the site. Search results, listing page, login/logout, search, etc. It's all looking pretty good. However someone has suggested to me that users might like to save an item as a favorite. So my idea behind that was to have a button on each of the grid items in the search results page. This is my search results page code with the button within the item. <form id="add_fav" name="add_fav" autocomplete="off" accept-charset="utf-8" action="./" method="post"> <button class="wish_btn" name="add_fav">Add Fav</button> </form> Where the business logic is on the page, this is what I have so far - I just don't know how to align an item to a user. $log->save ('pageview', 'testing'); function clense_input($data){ $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } $sort = "title"; // Logic for favorites if ($_SERVER["REQUEST_METHOD"] == "POST") { if (isset($_POST['add_fav'])) { $favs = $sanitizer->text($_POST['add_fav']); if(!empty($favs)){ $ticket = $pages->get($favs); // Set page name if($favs != null){ $favs->of(false); $favs->fav_title = $page->user->name; // Save username $favs->fav_title = $page->title->id; // Save page id to favs list $favs->save(); echo "Fav saved."; } } } }
- 6 replies
-
- input
- user favorites
-
(and 1 more)
Tagged with: