You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

delete-notes.php 422B

123456789101112131415161718192021222324
  1. <?php // Escaping the input data:
  2. $rid = $_POST['id'];
  3. $explodeid = explode("-",$rid);
  4. $id = intval($explodeid[1]);
  5. $xmla = simplexml_load_file('../db/notes.xml');
  6. $target = false;
  7. $i = 0;
  8. foreach ($xmla->note as $s) {
  9. if ($s['id']==$id) { $target = $i; break; }
  10. $i++;
  11. }
  12. if ($target !== false) {
  13. unset($xmla->note[$target]);
  14. }
  15. $xmla->asXML('../db/notes.xml');
  16. $target++;
  17. echo $target;