0
<html>
<title>Student Registration(1.html) </title>
<body>
<form name="fin" action="2.php" Method="post">
<table>
<Caption> Student Registration </Caption>
<tr>
<td>
Student Name: <input type='text' name='Sname' />
</td></tr>
<tr>
<td>
Student id: <input type='number' name='Sid' />
</td></tr>
<tr>
<td>
Student Class: <input type='text' name='Sclass' />
</td></tr>
<tr>
<td>
<input type='submit' value='Next" />
</td></tr>
</table>
</form>
</body>
</html>

<!----
When ever user clicks on next page he/she will redirected to 2.php
at dat time i want to store all the form data in xml.
here 2.php code Follows:
 ------->
----------------------------------------------------------------------------------------------


<?php
?>
 <html>
<title>Student Registration2 </title>
<body>
<form name="fin2" action="#" Method="post">
<table>
<Caption> Student Backgroun Details </Caption>
<tr>
<td>
Student Name: <input type='text' name='Sname' />
</td></tr>
<tr>
<td>
Father Name: <input type='number' name='Fname' />
</td></tr>
<tr>
<td>
Father OCupation: <input type='text' name='Foc' />
</td></tr>
<tr>
<td>
Permanent Address: <input type='text' name='Add' />
</td></tr>
<tr>
<td>
<input type='submit' value='Submit" />
</td></tr>
</table>
</form>
</body>
</html>
------------------------------------------------------------------------------------------
<!------
So wen ever user clicks Submit on 2page.here the registration completes.
At dis time i want to Retrive the Data of 1st page From Xml. & now I want to store all the data from (1st & 2nd page) in my database.

finally i need 2 things
1.  how to store the data in xml.
2. how to fetch the saved data in xml
3.by doing  1 & 2 i want to insert all data in my database

------->
2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by FakeTales
0

you can use simple xml or DOM xml in a php script to store the data. i have been using form data and by using jquery and php i am able to add new data to my xml file. For example

<?php


$xmlFileName = $_POST['xmlfile'];
$childNode = $_POST['childNode'];
if (file_exists('xml/'.$xmlFileName)) {
    $arrayElements = count($_POST) - 2;

    $xmlLoad = simplexml_load_file('xml/' .$xmlFileName);
    $child = $xmlLoad->addChild($childNode);
    $subChildNodes = array_keys($_POST);

    for($i = 0; $i < $arrayElements; $i++) {
        $subChildNode = $subChildNodes[$i];
        $subChildDataValue = $_POST[$subChildNode];
        $child->addChild($subChildNode, $subChildDataValue);
    }


    if (file_put_contents('xml/' .$xmlFileName, $xmlLoad->asXML())) {
        echo "Added new record to ".$xmlFileName ;
    } else {
        echo "Unable to add new record";
    }
} 


?>

can help a little bit more with using jquery if required

Edited by FakeTales

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.