Welcome Guest, Not a member yet? Register   Sign In
XML file generation error
#1

(This post was last modified: 04-18-2021, 09:08 AM by includebeer. Edit Reason: Use the PHP tags! )

dear  all 

i am trying to generate a XML file and save it into a folder  with Codeignitor 4
$xml->save("$path"); is showing error . my controller function is like 

PHP Code:
public function addnewcptcodes($id)

{
 

helper
(['form''url''array','xml''filesystem']);  

 
$icd_id
=base64_decode($id);

$cptcode$this->request->getVar('cptcode');
$cptdescn$this->request->getVar('cptdescription');
$cptcategory$this->request->getVar('icdcategory');
$cptprize$this->request->getVar('cptprize');


$path base_url('templates/assets/images/dataxmls/'.$icd_id.'/'.$icd_id.'_cpt.xml');
 
if (!file_exists($path))
{
$doc = new \DOMDocument('1.0''utf-8'); 

$doc->formatOutput true;

$r $doc->createElement('icd'); 
$doc->appendChild($r); 
$b $doc->createElement("cpt"); 
$b->setAttribute('id'$cptcode);
$code $doc->createElement("code"); 
$code->appendChild
$doc->createTextNode($cptcode
); 

$b->appendChild($code); 


echo 
$doc->saveXML();
$doc->save($path) ;

echo 
"here end"; 
}else {
echo 
"OKKKK"



please help to clear the error .

thanks 
sreejith
Reply
#2

Hi psreejiths, first can you enclose your code in [ php ] tags, it's easier to read. Also, post what error you get.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#3

You seem to have trouble adding the [ php ] tags... I did it for you on your original post...
What error do you get...?
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply
#4

base_url() - return URL
Reply




Theme © iAndrew 2016 - Forum software by © MyBB