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]