Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <link href="PPC.css" rel="stylesheet" type="text/css">
- </head>
- <center>
- <body>
- <div class="container">
- <header>
- <div class="primary_header" id="title">
- <h1 class="title"><a href="PetalPetCareSAT.php">Petal Pet Care</a></h1>
- </div>
- <nav class="secondary_header" id="menu">
- <ul>
- <li id="selected">ANIMAL INPUT</li>
- <li><a href="Howto.php">HOW TO USE</a></li>
- <li><a href="Database.php">ANIMAL DATABASE</a></li>
- </ul>
- </nav>
- </header>
- </div>
- <?php
- /*----------------------------
- Function write_xml
- Writes data to xml
- -----------------------------*/
- function write_xml($anm_name,$own_name,$sign_in,$meds,$spec,$food,$note){
- $file = 'data.xml';
- $elem = new SimpleXMLElement("data.xml",null,true);
- $count= count($elem->data);
- $count +=1;
- //print_r($count);
- $date=date("d/m/Y");
- $xml = simplexml_load_file($file);
- $load = $xml->measures;
- $help = $xml->addChild('data');
- $help->addChild('anm_name', $anm_name);
- $help->addChild('own_name', $own_name);
- $help->addChild('sign_in', $sign_in);
- $help->addChild('meds', $meds);
- $help->addChild('spec', $spec);
- $help->addChild('food', $food);
- $help->addChild('note', $note);
- $help->addChild('ID', $count);
- $xml->asXML($file);
- //print_r($xml);
- }
- ?>
- <section>
- <article class="output_article">
- <!--- Check if submitted and ANM_NAME is set and not empty -->
- <?php
- if(!empty($_POST['submit'])){
- if (isset($_POST['ANM_NAME']) && ! empty($_POST['ANM_NAME'])) { ?>
- <!-- Results if displayed -->
- <h3> <br>
- Output </h3>
- <table>
- <tr>
- <th>Animal Name</th>
- <td><?php echo $_POST["ANM_NAME"];?></td>
- </tr>
- <tr>
- <th>Owner Name</th>
- <td><?php echo $_POST["OWN_NAME"]; ?></td>
- </tr>
- <tr>
- <th>Sign in Date</th>
- <td><?php echo $_POST["SIGN_IN"]; ?></td>
- </tr>
- <tr>
- <th>Medication</th>
- <td><?php echo $_POST["MEDS"]; ?></td>
- </tr>
- <tr>
- <th>Special Requirements</th>
- <td><?php echo $_POST["SPEC"]; ?></td>
- </tr>
- <tr>
- <th>Food</th>
- <td><?php echo $_POST["FOOD"]; ?></td>
- </tr>
- <tr>
- <th>Note</th>
- <td><?php echo $_POST["NOTE"]; ?></td>
- </tr>
- </table>
- <br>
- <form method="get" action="AnimalInput.php">
- <button type="submit" id="button">Input New Data</button>
- </form>
- <!-- Declaration of basic variables -->
- <?php
- $anm_name=$_POST["ANM_NAME"];
- $own_name=$_POST["OWN_NAME"];
- $sign_in=$_POST["SIGN_IN"];
- $meds=$_POST["MEDS"];
- $spec=$_POST["SPEC"];
- $food=$_POST["FOOD"];
- $note=$_POST["NOTE"];
- write_xml($anm_name,$own_name,$sign_in,$meds,$spec,$food,$note);
- }
- }else{
- ?>
- <!--Data input and sectioning -->
- <h3>
- <br>
- Data Input
- <form action= "<?php $_SERVER['PHP_SELF'];?>" method="post" name="input" id="input">
- <br>
- <table>
- <tr>
- <th>Animal Name</th>
- <td><input type="text" name="ANM_NAME" id="ANM_NAME"></td>
- </tr>
- <tr>
- <th>Owner Name</th>
- <td><input type="text" name="OWN_NAME" id="OWN_NAME"></td>
- </tr>
- <tr>
- <th>Sign in</th>
- <td><input type="date" name="SIGN_IN" id="SIGN_IN"></td>
- </tr>
- <tr>
- <th>Medication</th>
- <td><input type="text" name="MEDS" id="MEDS"></td>
- </tr>
- <tr>
- <th>Special Requirements</th>
- <td><input type="text" name="SPEC" id="SPEC"></td>
- </tr>
- <tr>
- <th>Food</th>
- <td><input type="text" name="FOOD" id="FOOD"></td>
- </tr>
- <tr>
- <th>Notes</th>
- <td><input type="text" name="NOTE" id="NOTE"></td>
- </tr>
- </table>
- <br>
- <input type="submit" id="button" value="Submit" disabled="disabled">
- </form>
- <?php } ?>
- </center>
- </h3>
- </article>
- </section>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement