No information on google : I am trying to put in in to MYSQL and XML files but when i press to put in MYSQL it does that, and when i press to put in XML it puts in to MYSQL. I don't know how to fix that.

Well i looked all over the internet and couldn't find any information that could help me


I tried to fix this code for like 8 hours but couldn't find what was the problem with it.

    <?php
    include_once 'includes/DuombazesInfo.php'
    ?>

    <?php
    if(isset($_REQUEST['Ikelimas'])) {
    $xml = new DOMDocument ("1.0","UTF-8");
    $xml -> load("pavyzdysxml.xml");
    
    $rootTag = $xml -> getElementsByTagName ("document") -> item(0);
    
    $dataTag = $xml -> createElement("data");
    
    $nameTag = $xml -> createElement("name", $_REQUEST['name']);
    $lastnameTag = $xml -> createElement("lastname", $_REQUEST['lastname']);
    $emailTag = $xml -> createElement("email", $_REQUEST['email']);
    $passwordTag = $xml -> createElement("password", $_REQUEST['password']);
    
    $dataTag -> appendChild($nameTag);
    $dataTag -> appendChild($lastnameTag);
    $dataTag -> appendChild($emailTag);
    $dataTag -> appendChild($passwordTag);
    
    $rootTag -> appendChild($dataTag);
    
    $xml -> save("PavyzdysXML.xml");
    }


    if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = test_input($_POST["name"]);
    $lastname = test_input($_POST["lastname"]);
    $email = test_input($_POST["email"]);
    $password = test_input($_POST["password"]);
    }
    function test_input($data) {
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
    }
    ?>

    <!DOCTYPE html>
    <html>
    <head>
    <title>Lentele su duomenu baze</title>
    </head>
    <body>
    <h2>Savarankiškas darbas</h2>
    <form action="includes/prisijungimas.php" method="POST">
    <input type="text" name="name" placeholder="Vardas" required>
    <br><br>
    <input type="text" name="lastname" placeholder="Pavardė" required>
    <br><br>
    <input type="email" name="email" placeholder="El. Paštas">
    <br><br>
    <input type="text" name="password" placeholder="Slaptažodis" required>
    <br><br>
    <button type="submit" name="Įkelti"> Įkelti į duomenų bazę </button>
    <input type="button" value="Peržiūrėti duomenų bazės informaciją" 
    class="homebutton" id="btnHome" onClick="parent.location='index1.php'"/>
    <input type="button" value="Peržiūrėti XML failą" class="homebutton" 
    id="btnHome" onClick="parent.location='PavyzdysXML.xml'" />
    <input type="submit" name="Ikelimas" value ="Įkelti į XML failą">
    </form>

    </body>
    </html>