Inquiescent Posted August 21, 2012 Share Posted August 21, 2012 Hi! I have a page on which you can alter an XML file containing information as follows: <productlist> <product> <id>Id</id> <name>Name</name> <price>Price</price> </product> </productlist> Each product id, name and price are echoed through a for-each loop as text inputs which you can alter and save, thus changing the XML-file contents. For each product, there is also a checkbox with which you are supposed to use for deletion. If a product's checkbox is checked and the save button is pressed, I want the certain product which had it's checkbox checked to be deleted. Take a look at the attached image to see the output of the echo. Here is the problem: If you check a box, no matter which one, product number 1 gets deleted. If you check two boxes (again, whichever you like), product 1 and 2 gets deleted, etc. This is the code for the checkbox in the foreach loop; echo "<input type='checkbox' id='checkbox' name='deleteProduct' />Delete"; There doesn't seem to be any difference namewise between the checkboxes for some reason. If I alter the checkbox name to <b>name='deleteProduct'</b>, the second entry gets deleted when you press the save button, no matter which box you check. I know that I'm not revealing much of the code here, but that's because the majority of it doesn't really have anything to do with the problem. If anyone would take time to help me, I'd gladly show you all of the code in a PM. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.