Is this feasible??

Discussion in 'PHP' started by resting, Jul 2, 2009.

  1. #1
    I know nuts about cookies. but I'm guessing its one of the easiest way for javascript to talk to php without the long url encoding.

    Here's the plan.

    When the user clicks the HTML delete link, it calls a javascript function which grabs all the checked checkboxes and then, writes the values to a cookie.
    After that, it redirects to a php script which will read all the values from that cookie and proceed to process the deletion.

    My question is, is it feasible? I figured it'll take me some time to figure this out so if someone has some head start for me, that'll be great. Thanks.
     
    resting, Jul 2, 2009 IP
  2. HorseGalleria

    HorseGalleria Peon

    Messages:
    91
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why not POST the values to your php script? No long URLs or GET strings.
     
    HorseGalleria, Jul 2, 2009 IP
  3. ajaymisrad

    ajaymisrad Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Infact as the above member said, you could do multiple delete through php script itself (without the need for javascript).

    You can collect the value of multiple checkboxes as an array thru post method.
    And then through loop function you can delete the selected items (multiple) from your db.
     
    ajaymisrad, Jul 3, 2009 IP
  4. Wrighty

    Wrighty Peon

    Messages:
    199
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'd do this through some form of AJax to be honest! :-/
     
    Wrighty, Jul 3, 2009 IP
  5. newgenservices

    newgenservices Well-Known Member

    Messages:
    862
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    105
    Digital Goods:
    1
    #5
    AJAX is used to enhance the user experience but the primary scripting would be handled by PHP and not AJAX. We can achieve this using plain PHP and a simple form as well.
     
    newgenservices, Jul 3, 2009 IP
  6. szalinski

    szalinski Peon

    Messages:
    341
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    yep, AJAX isn't the 'solution to everything' - it's just an enhancement. You could use cookies to do what you want, in fact I'm certain IPB uses that method for multi-topic deletion (only in Admin account). However, as pointed out, it's far easier to just use multiple POST values. So why do Invision use the cookie method then, you ask? Well, because they want a user to be able to tick a few boxes for deletion, then 'go to page 2' without losing the last selections, which remain in the cookies. :)
     
    szalinski, Jul 3, 2009 IP