SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru hifigrafix's Avatar
    Join Date
    Oct 2005
    Location
    Nashville, TN
    Posts
    628
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Submitting Null Form Element Value

    Greetings,

    I'm using Paypal's standard payment method to run a very simple shopping cart for a site.

    The checkout process has 3 items - item_name_1, item_name_2, item_name_3

    My problem is that paypal insists that you submit items in order 1/2/3 and I'm currently using checkboxes with corresponding i_n_1, i_n_2 etc...

    If a user does not want product 1 but DOES want 2 and 3 then they get sent to paypal but the cart is empty since item_name_1 wasn't posted.

    What would be my easiest bet for making sure that items get sent in numerical order?

    Should I send the item with a value of 0.00 or is there an easy JS trick to rename the items 1, 2, 3 accordingly as they are checked?

    Thanks!

    jw

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You should use the Paypal supplied "Add to Cart" functionality to add the selected entries to the shopping cart rather than hard coding the names yourself. The _1 _2 etc get added to the ends of the field names by the cart processor as the entries are added.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

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