Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cookies and forms

    I need to use Cookies with order forms

    I need to use the cookies to do like a checkout page, after the user has chosen certain products, each product had an order button to add it if the user wants it, so if the user add the item to their shopping cart , using the cookies I would like to hold the item within an array then store the array indexes rather than detailed item information in the cookie.
    Then I would like to display the itmes on a separate line within a table along with the default quantity, price and total then a sub-total and grand total... an update button to update the quantity, it is nearly like Amazon website....I am a beginner in JS and this is a bit complicated for me specially the use of cookies and arrays.
    Many thanks

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Edinburgh, UK
    Posts
    402
    Thanks
    2
    Thanked 1 Time in 1 Post
    Okay although it probably possible to do what you've asked, it'd would cause a lot of problems, and there's no guarentee that it'll work for every user that visits your site and the code will be on the large size.

    My suggestion would be to learn PHP or ASP or some other server-side language and build a shopping system using these languages and a database. I can't promise that the code will be shorter, but it's more likely to work and you don't have to rely on the user having JS enabled and cookies enabled.

    JS is okay for doing simple little tasks, but for a shopping system it's not going to be powerful enough.

    Sorry I can't be of more help. If you want to know more about cookies and arrays, search this forum for previous posts, there'll be plenty of previous questions answered to help you understand cookies and arrays.
    Rich

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."

  • #3
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I need to do it in Javascript , this is my assignement....

  • #4
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by mag wa
    I need to do it in Javascript , this is my assignement....
    Then shouldn't you be figuring this out yourself?

  • #5
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It is a long assignement and I am stuck with the cookies bit, I cannot move from there, I need help with that bit....(online course, have no tutor...)

  • #6
    New to the CF scene
    Join Date
    Jan 2005
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Any ideas, I am trying to do it, but no use...
    here is a code that I have done, but don't know how to make an array for different files, I mean every product has got a different file, how to make an array to hold cookies from different files..
    here is one of the files

    <HTML>
    <HEAD>
    <TITLE>CD Kings</TITLE>


    </HEAD>

    <BODY BGCOLOR="LIGHTBLUE">
    <IMG SRC="King.jpg" Border=0>

    <font face="default">

    <b><font face="verdana, arial, helvetica" color="#CC6600">
    Track Listings</font></b></font>
    <br>
    <b>Disc: 1</b><br>
    <table width=100% cellpadding=3 cellspacing=0 border=0>
    <tr valign=top><td width=50%>
    1. O Come, O Come, Emmanuel!<br>
    2. Once In Royal David’s City<br>3. Angels, From The Realms Of Glory<br>
    4. Adam Lay Ybounden<br>5. O Little Town Of Bethlehem<br>6. In Dulci Jubilo<br>
    7. The First Nowell<br>8. I Saw Three Ships<br>9. God Rest You Merry, Gentlemen<br>
    10. Quem Pastores Laudavere<br>11. Personent Hodie<br>12. The Holly And The Ivy<br>
    13. A Spotless Rose<br>

    </td><td width=50%>
    14. Away In A Manger<br>
    15. While Shepherds Watched<br>
    16. Tomorrow Shall Be My Dancing Day<br>
    17. Up! Good Christian Folk And Listen<br>
    18. In The Bleak Midwinter<br>19. Ding Dong! Merrily On High<br>
    20. Silent Night<br>21. The Three Kings<br>22. The Lamb [Tavener]<br>
    23. Sussex Carol<br>24. O Come, All Ye Faithful<br>
    25. Hark! The Herald Angels Sing<br>
    </td></tr>
    </table>
    <b>Disc: 2</b><br>

    <table width=100% cellpadding=3 cellspacing=0 border=0>
    <tr valign=top><td width=50%>
    1. Miserere-Allegri [Abridged]<br>
    2. Vespers-Monteverdi<br>
    3. Jesu, Joy Of Man’s Desiring-Bach<br>
    4. Ave Verum Corpus-Mozart<br>5. Magnificat-Bach<br>
    6. Dear Lord And Father Of Mankind-Parry<br>7. Chichester Psalms-Bernstein<br>
    8. I Was A Lad-Parry<br>9. Jubilate Deo-Britten<br>10. Thou Knowest Lord-Purcell<br>
    11. Ave Verum Corpus-Byrd<br>
    </td><td width=50%>
    12. Vespers-Rachmaninov<br>13. Requiem-Durufle<br>14. Requiem-Rutter<br>15. Requiem-Faure<br>16. Beati Quorum Via-Stanford<br>17. Totus Tuus-Gorecki [Abridged]<br>18. Salvator Mundi-Tallis<br>19. Zadok The Priest-Handel<br>20. Five Mystical Songs-Vaughan Williams<br>21. Messiah-Handel<br>22. Gloria-Vivaldi<br>

    </td></tr>
    </table>

    <SCRIPT>
    <!--
    function SetCookie(){
    var WantToBuy=prompt("Do you want to Add this product into your shopping cart,yes or no");
    document.cookie="BuyKingCD="+WantToBuy;
    alert(document.cookie);
    if (BuyKingCD=="yes")
    {
    CheckoutArray
    }
    }
    //-->
    </SCRIPT>
    <FORM NAME="myForm">
    <INPUT TYPE="button" Value="Order Now" onClick="SetCookie()">

    </FORM>
    <SCRIPT>

    </Script>



    Please help, I am in a mess!!!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •