Jump to content

Inquiescent

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by Inquiescent

  1. Hey guys, I solved it by doing the following: $allProducts = $DOM->getElementsByTagName('products'); $count = $allProducts->getElementsByTagName('product')->length; for ($i=0; $i<=($count); $i++) { echo "<br><input type='checkbox' id='checkbox' name='deleteProduct[".$i."]' />Delete entry ".$i."</br>"; } The deletion code was so confusing that solving it this way was quite relieving.
  2. 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[2]'</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!
  3. Thanks! I didn't really understand why it didn't work, but that might surely be the problem. Does anyone have any idea of what to do to solve this?
  4. Hello guys, I currently have a problem with echoing text coming from an external site, using file_get_contents. I won't consider myself a great PhP programmer, so I'll gladly appraciate any help! The code I am using is very simple: <?php $homepage = file_get_contents('http://www.live365.com/scp/web/stn/playlist.html?station=kolonku'); echo $homepage; ?> However, the result comes out blank. If I change the link to a page made out of HTML, the code works, but the text here is a tracklist of a Live365 radio station. It changes dynamically according to what song is currently playing. I guess the code behind all this is formidable, to say the least, and I can't tell if it's made out of Javascript or PhP, or something else. Is there any way that I can solve this? I was thinking of getting the contents, then have the function updating every 10 seconds or so, so that the text is up to date most of the time. The current problem however, is getting something at all in the first place! Link to the site I want to get the contents from (it updates atomatically! The source code won't give me a clue to what's going on..): http://www.live365.com/scp/web/stn/playlist.html?station=kolonku
×
×
  • 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.