Jump to content

otonix

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by otonix

  1. I am having a nightmare with an explode and cant get it to work. I am posting a string using JQuery to a PHP form which needs to explode the string into an indexed array to be inserted into a database. This is what the string looks like "importance%5B101%5D=50&importance%5B100%5D=50&importance%5B99%5D=50&importance%5B98%5D=50" The original array has been serialised into the above string. The arrayname is importance. The array's index (inside the square brackets) is referenced from an ID from the page. The square brackets have been replaced by '%5B' and '%5D' and surround the array index by the JQuery. The value for each of these array items is shown as =50. So its basically the same as a GET when we have name=value&name1=value1etc') How would i explode the string above to remove the '%5B' and '%5D' to make the '[' and ']' reappear and then from then it can be read as a GET post? like 'name=value&name1=value1etc'. Using the new array of that index ready to be inserted into a MySQL database. Im going mad trying to solve this!!!
  2. David - Your a ledgend! Ive been pulling my hair out all morning! Cheers!
  3. okay basically Ive managed to be able to post it as a sting that would look like this. 21,,hello///20,,goodbye/// How can i run a loop to - get the id (int after ///) -string (after the ,,) and then turn these into variables that as the loop cycles, inserts the string where ID matches string?
  4. Okay heres the problem. I have a form which displays items that sit within a packet. (In this case its called Wireless Package 1). Each item has its own specific value, which can be any string, hench why there is an 'input type= text' in the value column in the table. Each of these values is stored in a table, with the primary key 'piid', (show as a hidden field within 3rd column). The problem is when im posting the array 'values[]' I cant distinguish between what value needs to be referenced againist a piid, how do i obtain these individual ID's and Values in a loop so they can turned into a MySql Strings????? I tried using an explode function but got no where, any help is very much apprieciated! This is the code for the form displayed. <table border="1" cellpadding="5" cellspacing="5"> <tr> <th>Item ID</th> <th>Item</th> <th>Value</th> <th>Remove</th> </tr> <form action="edit_packet.php" method="post"> <?php foreach($packages as $packet):?> <tr> <td> <?php echo $packet['piid'] ;?> </td> <td> <?php echo $packet['desc'] ;?> </td> <td> <input type="hidden" name="values[]" value="<?php echo $packet['piid'];?>,," /> <input type="text" name="values[]" value="<?php echo $packet['value']; ?>" /> <input type="hidden" name="values[]" value="///" /> </td> <td> <form action="delete.php" method="post"> <input type="hidden" name="pid" value="<?php echo $packet['piid'];?>"/> <input type="submit" value="Delete Packet"> </td> </tr> <?php endforeach; ?> </table> <input type="submit" value="Submit" /> </form> [attachment deleted by admin]
×
×
  • 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.