Removing [] from post request

  • rileymotorcompany
    Asked on February 13, 2017 at 11:18 AM

    I would like to have the ability to remove the brackets, [], from the post request, when a field is comprised of more than one field's value. For example, my birthday field is currently 3 fields, which get combined into a single field and, on the outgoing post request sends birthday[] instead of just birthday

    There are a couple more forms fields as well the the [] and need that removed so this will pass into the software I am using.

  • Elton Support Team Lead
    Replied on February 13, 2017 at 12:34 PM

    Enclosed with square brackets are its key values. In PHP, arrays are formatted in such way. And array elements can be accessed using the array[key] syntax.

    Example:

    Removing [] from post request Image 1 Screenshot 20

    You can use

    $_POST['bdate']['0'] to get the month

    $_POST['bdate']['1'] to get the day

    $_POST['bdate']['2'] to get the year

    You can actually define in your script to strip off the [] symbols. I'm sure that's possible.

    Hope this helps!