Jake Brunton
Jake Brunton

Reputation: 27

How to make a user wish list in PHP

So, basically I'm making a little site that has some pages with video game's info and media. I have a user account system setup, but there's something I've been wanting to know how to add. I'm still new to PHP, and I made the user account system only by following a tutorial. Anyways, here's the HTML code that shows on a game info page when a user is logged in:

<form name="wishlistAdd" action="wish_list.php">
<input type="checkbox" name="wagakkiwa_wish" id="wagakkiwa_wish" /> &nbsp; 
<label for=wagakkiwa_wish>Add <b>WAGAKKIWA</b> to your Wish List?</label><br />
<input type="submit" class="button" value="Add to List" /> This is a alpha feature. It   won't work currently.
</form></div>

Basically, what I'm wanting to achieve is if the user logged in checks the box then clicks 'Add to List' it will add it to a list in their User Account Home page under the section 'Wishlist.' For example, if I added that game to my wishlist and I went back to the /user/ section of the site, in the right column under 'Wishlist' it would show 'WAGAKKIWA' as an a tag to that page. Then, if I did it for another game it would add it ontop.

So, what would I need to do to accomplish this? Do I have to add a certain column to the user's table in my DB and have the posted items for the wishlist submitted and retrieved? Any and all answers are appreciated, thank you.

Upvotes: 1

Views: 7723

Answers (1)

Agoeng Liu
Agoeng Liu

Reputation: 702

for the table wishlist, the fields are : Id,UserIP, ProductsID Id only autoincrement ID UserIP to record visitor's IP ProductsID to record ProductsID which cliked by visitor

After you click submit, then you must insert record to table wishlist, then to display you must select all table wishlist and left outer join with table product with ProductsID.

Hopefully you understand with my short explanation

Upvotes: 1

Related Questions