Jump to content

create element with variable


quincewyss

Recommended Posts

this line of code is causing an error because I'm using a variable i.e.$var

$cb = $dom->createElement($var);

 

The error I'm getting is:

Fatal error: Uncaught exception 'DOMException' with message 'Invalid Character Error' in /mnt/gs01/herd02/1703/domains/amerprop.com/html/manager/php/create_xml.php:121 Stack trace: #0 /mnt/gs01/herd02/1703/domains/amerprop.com/html/manager/php/create_xml.php(121): DOMDocument->createElement('') #1 {main} thrown in /mnt/gs01/herd02/1703/domains/amerprop.com/html/manager/php/create_xml.php on line 121

 

Does anyone know how to plce a ver there without creating an error?

 

Thanks!

Quince

Link to comment
https://forums.phpfreaks.com/topic/92344-create-element-with-variable/
Share on other sites

I got it to work.  Thanks for the help.  Acutally the underscores are working fine in the tag names it's spaces that you can't use i.e.

<?xml...?>
   <group_works>
   </group_works>
   <group does not work>
   </groupdoes not work>

The var was named wrong. 

sometimes it's just one of those simple things overlooked.

 

Thanks again!

Quince

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.