XML attributes in PHP
| From: | Matrix 01 | Date: | Sat, 25 Nov 2000 20:46:28 +0000 |
| Subject: | XML attributes in PHP | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-39125@lists.php.net to get a copy of this message | ||
I have the following XML:
<FORM>
<CHECKBOX NAME="checkbox" VALUE="PHP"/>
<TEXTBOX SIZE="24" NAME="Name_Field"/>
</FORM>
Is there any way if getting the contents of attribute in PHP?
I want to read the content in to a string and then apply a conditional match
on the element so that once it finds the element it can take the content of
the attribute and print it out:
//I have read the xml above into $textfield
if (preg_match ("/\bCHECKBOX\b/i", "$textfield")) {
print "Name=$(Content of name attribute)";
print "VALUE=$(Content of value attribute)";
}
if (preg_match ("/\bTEXTBOX\b/i", "$textfield")) {
print "Name=$(Content of name attribute)";
print "Size=$(Content of Size attribute)";
}
Please can you guide me.
Thanks,
-----------------------------------------------
FREE! The World's Best Email Address @email.com
Reserve your name now at http://www.email.com