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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Location
    austin, tx
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Breaking up Field Value (doable?)

    "$cart" is being submitted to a form, but it contains information that I need to break apart and have separate field names for (i.e. $cart[0], $cart[1], $cart[3]).

    The format it is being submitted as (keep in mind the form is coming to my php file but not from anything I control, I really do need a workaround) a format that I believe this should be doable. A sample $cart is submitted looking like this:
    This Product : 2 : 52.00

    See the good thing is each item I need individually is separated by " : ", so is there a way to pull this apart to =

    $cart[0] = "This Product"
    $cart[1] = "2"
    $cart[2] = "52.00"

    Thanks in advance.

  • #2
    Regular Coder Tyree's Avatar
    Join Date
    Sep 2003
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try the split() function. It allows you to "split" a string with a delimiter...the ':' in your string.

    So...
    PHP Code:
    $cart "Product : 2 : 52.00";

    $cartArray split(":"$cart); 

  • #3
    Regular Coder
    Join Date
    Apr 2005
    Location
    austin, tx
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you.


  •  

    Posting Permissions

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