Reputation: 3301
Here is a simple form to send to admin_xml.php
<form name="review" action="admin_xml.php" method="post">
<textarea name="xml" cols="40" rows="10"></textarea>
<input class="submit" type="submit" value="Submit Request">
</form>
Here is the XML which I want to enter into the form to extract Data from MySQL Database.
<?xml version="1.0" encoding="UTF-8"?>
<GetOrdersIds>
<Credentials>
<Username>my_username</Username>
<Password>my_password</Password>
</Credentials>
<Criterions>
<OrderNumber></OrderNumber>
<CustomerName></CustomerName>
<StartDate></StartDate>
<EndDate></EndDate>
<OrderStatus></OrderStatus>
</Criterions>
</GetOrdersIds>
What I want to achieve is when I enter the above XML data in the HTML form, it should go through my Database and match the tags in my database and extract that data and retrieve it back.
How to create a new request and add changes in admin_xml.php (parse XML request, check up, and then extract data from the database).
I would like to automate it, create certain fields which would be selectable. In this way, I can select which tags (data) from the database.
Upvotes: 0
Views: 1373
Reputation: 56106
Everything you need is already baked into PHP:
Use SimpleXML to process the XML file into something meaningful.
Use the method described at php.net/mysql_list_fields to retrieve valid column names:
Once you have validated the requested database fields, create your SQL query.
Upvotes: 1