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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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