473,396 Members | 1,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How can I generate XML from this code?

178 100+
Hi,

I know how to generate xml from php but is there an easier way to generate xml from my code?

[HTML]<?php

$quote=$_GET['quote'];
//echo $quote;
require "config.php";
$q1 = mysql_query("SELECT * FROM quote WHERE quote_id = '$quote'");
$r = mysql_fetch_array($q1);
$total = $r['total'];
$proj = $r['proj_id'];
//echo $total;
$q2 = mysql_query("SELECT * FROM project WHERE proj_id = '$proj'");
$e = mysql_fetch_array($q2);
?>
<html>
<head>
<title>TES - Quote: <?php echo $e['company_name'] . "-" . $e['project_name'] ?></title>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
th {
background: white;
padding: 10px 0px;
text-align: center;
}
td {
background: white;
padding: 10px 0px;
text-align: center;
}
label {
background: white;
padding: 10px 0px;
text-align: right;
}
#proj_details {
padding: 10px 10px;
width: 100%;
height: 150px;
}
#submit {
padding: 10px 80%;
}

</style>
<script type="text/javascript">
function addvalue() {
var item = document.getElementById("item").value;
var desc = document.getElementById("qty").value;
var tcost = document.getElementById("tcost").value;

var tbl = document.getElementById('myTable1');
var lastRow = tbl.rows.length;
// alert (lastRow);
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);

// cell number
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellLeft.appendChild(textNode);

// item
var cellitem = row.insertCell(1);
var x1 = document.createTextNode(item);
cellitem.appendChild(x1);

// description
var celldesc = row.insertCell(2);
var x2 = document.createTextNode(desc);
celldesc.appendChild(x2);

// description
var celltcost = row.insertCell(3);
var x3 = document.createTextNode(tcost);
celltcost.appendChild(x3);

//clear fields
document.getElementById("item").value = "";
document.getElementById("qty").value = "";
document.getElementById("tcost").value = "";
document.getElementById("item").focus();

}
</script>
<head>
<body>
<fieldset id="proj_details">
<legend>Project Details</legend>
<div>Company Name: <span><?php echo $e['company_name'] ?></span></div>
<div>Project Name: <span><?php echo $e['project_name'] ?></span></div>
<div>IP Rating: <span><?php echo $e['ip_rating'] ?></span></div>
<div>Form: <span><?php echo $e['form'] ?></span></div>
<div>Access: <span><?php echo $e['access'] ?></span></div>
<div>Cable Entry: <span><?php echo $e['cable_entry'] ?></span></div>
<div>Fault Rating: <span><?php echo $e['fault_rating'] ?></span></div>
<div>Project Manager: <span><?php echo $e['proj_manager'] ?></span></div>
<div>Panel Cost: £<span><?php echo $total ?></span></div>
</fieldset>
<fieldset>
<legend>Add extra items to price</legend>
<table width=100% id="myTable1">
<tr>
<th></th>
<th>Item</th>
<th>Description</th>
<th>Total Cost</th>
</tr>
</table>
<fieldset>
<table border=0>
<tr>
<td><label for="item">Item</label>
<input type="text" id="item"></td>
<td><label for="qty">Description</label>
<input type="text" id="qty"></td>
<td><label for="tcost">Total Cost</label>
<input type="text" id="tcost"></td>
<td><input type="button" value="Add" onClick="addvalue()"></td>
</tr>
</table>
</fieldset>
</fieldset>
<fieldset>
<legend>Terms and Conditions</legend>
<fieldset>
<legend>Payment Terms</legend>
<textarea rows="3" cols="140" id="payment">
</textarea>
</fieldset>
<fieldset>
<legend>Quotation Validity</legend>
<textarea rows="3" cols="140" id="valid">
</textarea>
</fieldset>
<fieldset>
<legend>Delivery Period</legend>
<textarea rows="3" cols="140" id="delivery">
</textarea>
</fieldset>
</fieldset>
<div id="submit"><input type="button" value="Submit"></div>
</body>
</html>[/HTML]
Oct 30 '08 #1
3 1856
Dormilich
8,658 Expert Mod 8TB
I can't see where or what xml you want to generate in your code. currently it's not even well-formed (despite valid) xhtml.

regards
Oct 30 '08 #2
cleary1981
178 100+
I want to convert all the fields in the HTML into an XML document
Oct 30 '08 #3
Dormilich
8,658 Expert Mod 8TB
what shall the xml be like?

one possible way is transforming the xhtml (respectively the output buffer containing the xhtml) by a xsl stylesheet. but there are easier ways, depending on the xml.
Oct 30 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Tran Tuan Anh | last post by:
Dear all: I need your advice on this matter. I am working on a program which takes some pieces of System-C code in and generate some other System-C code. (System-C code is just C++ with some...
9
by: Henk Verhoeven | last post by:
We are not alone! "Where other MDA tools are generating programmingcode, Codeless chooses not to generate code at all". OK, phpPeanuts is not an MDA tool (it has no fancy modeling GUI). But it...
4
by: k.mitz | last post by:
Hi, I have a PHP application that allows users to generate a .pdf report of their database content. Normally, I've had to refresh a page to call the script to generate the report, so there's a...
0
by: momina_dar | last post by:
AlachiSoft “TierDeveloper” eradicates the problem of writing thousands of lines of code for your middle tier. Many software solutions on the market can do it for you but according to our research...
4
by: Stephen | last post by:
I need to generate input XML for another application by serialising classes defined in an XSD document. The code below will generate the XML I require but I need to generate this in memory rather...
8
by: Thomas Stegen | last post by:
I have written a code generator. To be more specific it is a code generator generator. As in a generator that generates code generators. If you run the generator on its own source code you get a...
1
by: A Traveler | last post by:
Hello, i am having this problem. The exact error message is: "Unable to generate code for a value of type 'System.Web.UI.Page'. This error occurred while trying to generate the property value for...
8
by: Bill Rust | last post by:
I've created an "Add Item" wizard for VB.NET 2003 that allows a user to add a specialized class that works with my application framework. In the wizard, the user can select the interfaces they...
6
by: Gnic | last post by:
Hi, Instead of running "sn-k" to generate a key pair, I need to generate the key file in code, is there anyone know how to generate key files in .NET code? Any help is appreciated. Gnic
3
by: joshblair | last post by:
Hello, Has anyone ever seen or created such a code generator? I'm looking for a sample of a code generator that will generate code (preferably one that uses C# and the XMLTextWriter) to create...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.