Jump to content

DOMElement error


alin19

Recommended Posts

i have this code from a book i read, and i don't see whay it is not working

 

the red one is the line from the book, the green one is write by me, neither one is working

 

Parse error: parse error in c:\program files\easyphp1-8\www\test\verifica.php on line 18

 

<?php

 

define ('DOCXML', 'student.xml');

header('Content-type:text/xml');

function verifica ($un_nume) {

 

$dom=new DOMDocument ();

$dom->load(DOCXML);

if (!$dom) { return 0;

 

}

 

$radacina =$dom->documentElement;

$utilizatori = $radacina->getElementByTagName('utilizator');

foreach ($utilizatori as $utilizator) {

$nume=$utilizator->getElementByTagName('nume');

 

if ($un_nume!=$nume->item(0)->nodeValue) {

if (!strcasecmp($un_nume,$nume->item(0)->nodeValue)) {

 

return 1;

}

}

return 0;

}

echo '<?xml version="1.0"?>'; ?>

<raspuns>

  <metoda>verificaNume</metoda>

  <rezultat>

<?php echo verifica($_REQUEST['nume']); ?>

</rezultat>

  </raspuns>

 

Link to comment
https://forums.phpfreaks.com/topic/120709-domelement-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.