this is my php code to check whether a tag named $GEcode exsits as node in _.xml file: in line 4, when I write GEcode=$GEcode, it echo 'not exsits', when the quotation marks exsit(GEcode='$GEcode'), it return "exsits". I am confused, $GEcode is already a string, why still need quotation marks? (in the form, name="GEcode"; value = "GE1319")
1.<?php
2.$courselist = simplexml_load_file("_.xml");
3.$GEcode = $_POST['GEcode'];
4.$course=$courselist->xpath("child::course[GEcode='$GEcode']");
5.if(empty($course)){
6.echo "not exsits";
7.}
8.else{
9.echo "exsit";
10.}
11.?>