Jump to content

ale1981

Members
  • Posts

    65
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

ale1981's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks, I knew there would be a regex way, I am just useless when it comes to regex! I am guessing the .replace is quicker as it is done with one function?
  2. sorry, yes, i would like the string 'products.0.name' converted to string 'products[0][name]'
  3. I have a string e.g. products.0.name and I want to change the string to; products[0][name] I have come up with some code that works but is a bit of a hack, my code is below; var array = field.split("."); field = array[0]+'['+array[1]+']['+array[2]+']'; Is there a better way, I am sure there is using regex? Thanks
  4. Thanks for the detailed response. I am adding the fields dynamically so I do not know how many the user is going to have, I guess I could use a bit of JS to determine this. Yes the SQL query will be one query, I used the above as an example of what I needed. Thanks for all responses.
  5. Thanks Ch0cu3r that worked, I knew there would be a simple answer! I have 2 input fields that use the same variable array, e.g. <input type="text" name="productVariations[name][]" /> <input type="text" name="productVariations[price][]" /> Is there a different way?
  6. It's late in the day and I can't figure this one out, I know it's going to be pretty easy! I have a form which sends the following array; array:2 [▼ "names" => array:3 [▼ 0 => "Default" 1 => "100ml" 2 => "150ml;" ] "prices" => array:3 [▼ 0 => "12.99" 1 => "9.99" 2 => "14.99" ] I want to loop the array and do an insert using this array like so, the index from "names" and "prices"; INSERT INTO DB VALUES('Default',12.99); INSERT INTO DB VALUES('100ml',9.99); INSERT INTO DB VALUES('150ml',14.99); Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.