GET syntax in xpath
- by David Doria
I am trying to use a parameter that I pass to the page in an xpath query. This works properly (hard coded):
<?php
$xml = simplexml_load_file("bookstore.xml");
$res = $xml->xpath("/bookstore/book[title = 'Everyday Italian']");
echo $res[0]->author
?>
but I pass the parameter with:
bookdetails.php?title="Everyday Italian"
and then do:
<?php
$xml = simplexml_load_file("bookstore.xml");
$res = $xml->xpath("/bookstore/book[title = $_GET['title']]");
echo $res[0]->author
?>
I get a 500 error.
Any thoughts?
Thanks,
David