Hello,
Please help m e out as I donot have the Database.
I have a form.
When a user clicks the submit button. I want all the contents to be written to a file and in the next page I want to display only some contents of the file( I mean if it were database, i would like to display only some columns). If another user enters the details, the foem should get appended.
Any help is really appreciated as I donot have the database and the application is really important
Writing the contents of forms to xml
Moderator: General Moderators
As i understand that some of the php.net example are a bit.. overwelming.
here is something simple.
There is also the javascript way. take a look at this link Create XML using Javascript
Play with it.. and with some of the examples from the links that protokol gave you
here is something simple.
There is also the javascript way. take a look at this link Create XML using Javascript
Code: Select all
<?
$doc = new_xmldoc('1.0');
$root = $doc->add_root('members');
$member = $root->new_child('member','');
$member->new_child('lastName','John');
$member->new_child('firstName','Adams');
$member->new_child('contribution','3400');
$member = $root->new_child('member','');
$member->new_child('lastName','Debra');
$member->new_child('firstName','Hones');
$member->new_child('contribution','2400');
$member = $root->new_child('member','');
$member->new_child('lastName','Jake');
$member->new_child('firstName','Tudor');
$member->new_child('contribution','1200');
$fp = @fopen('members.xml','w');
if(!$fp) {
die('Error cannot create XML file');
}
fwrite($fp,$doc->dumpmem());
fclose($fp);
?>