Hi..!
I had code for upload excel file and come to know that i can only upload excel sheet(file) by changing it in xml first and then display or store in database. My upload window code is:
************************************************** ******************
//"upload.php"
<?
include 'config.php';
//file for username, ipaddress password ...etc to connect database(no required here).
include 'opendb.php';
//file to execuete mysql queries (no required here).
?>
<html>
<head>
<title>Upload File To MySQL Database</title>
</head>
<body>
<form action="import.php" method="POST" enctype="multipart/form-data">
<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
<tr>
<td width="246"><input type="hidden" name="MAX_FILE_SIZE" value="30000">
<input name="file" type="file" class="box" id="file">
</td>
<td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
</tr>
</table>
</form>
</body>
</html>
************************************************** *****************
Code to upload that xml file is shown below-
************************************************** *****************
//"import.php"
<?php
$data = array();
function add_person( $calldate, $calltime, $dialedno, $city, $calltype, $duration, $callrate, $amount )
{
global $data;
$data []= array(
'calldate' => $calldate,
'calltime' => $calltime,
'dialedno' => $dialedno,
'city' => $city,
'calltype' => $calltype,
'duration' => $duration,
'callrate' => $callrate,
'amount' => $amount
);
}
if ( $_FILES['file']['tmp_name'] )
{
$dom = DOMDocument::load( $_FILES['file']['tmp_name'] );
$rows = $dom->getElementsByTagName( 'Row' );
$first_row = true;
foreach ($rows as $row)
{
if ( !$first_row )
{
$calldate = "";
$calltime = "";
$dialedno = "";
$city = "";
$calltype = "";
$duration = "";
$callrate = "";
$amount = "";
$index = 1;
$cells = $row->getElementsByTagName( 'Cell' );
foreach( $cells as $cell )
{
$ind = $cell->getAttribute( 'Index' );
if ( $ind != null ) $index = $ind;
if ( $index == 1 ) $calldate = $cell->nodeValue;
if ( $index == 2 ) $calltime = $cell->nodeValue;
if ( $index == 3 ) $dialedno = $cell->nodeValue;
if ( $index == 4 ) $city = $cell->nodeValue;
if ( $index == 5 ) $calltype = $cell->nodeValue;
if ( $index == 6 ) $duration = $cell->nodeValue;
if ( $index == 7 ) $callrate = $cell->nodeValue;
if ( $index == 8 ) $amount = $cell->nodeValue;
$index += 1;
}
add_person( $calldate, $calltime, $dialedno, $city, $calltype, $duration, $callrate, $amount );
}
$first_row = false;
}
}
?>
<html>
<body>
<table>
<tr>
<th>calldate</th>
<th>calltime</th>
<th>dialedno</th>
<th>city</th>
<th>calltype</th>
<th>duration</th>
<th>callrate</th>
<th>amount</th>
</tr>
<?php foreach( $data as $row ) { ?>
<tr>
<td><?php echo( $row['calldate'] ); ?></td>
<td><?php echo( $row['calltime'] ); ?></td>
<td><?php echo( $row['dialedno'] ); ?></td>
<td><?php echo( $row['city'] ); ?></td>
<td><?php echo( $row['calltype'] ); ?></td>
<td><?php echo( $row['duration'] ); ?></td>
<td><?php echo( $row['callrate'] ); ?></td>
<td><?php echo( $row['amount'] ); ?></td>
</tr>
<?php } ?>
</table>
</body>
</html>
************************************************** ********************
The excel file changed in xml, which is required to upload is below-
(this file is saved as with ".xml" extention with "xml spreadsheed type")
************************************************** ****************
calldate calltime dialedno city calltype duration callrate amount
10-Mar-07 10:10:10 99999999 sre std 1:01:01 2.4 135.9
11-Mar-07 11:11:11 88888888 ssw local 11:11:11 1.2 111.35
21-Mar-07 21:21:21 77777777 kanpur local 12:12:12 1.2 122.25
************************************************** ******************
This code is uploading means displaying properly, with php5.1 (which is installed on windows of my pc) but there is error in php4.2.2( which is installed in my office computer at which i work through telnet (my office machine os is windows-xp sp-2). mysql, apache and php4.2.2 is install on this machine.
NOTE: I read out that for php4, i have to use DOMXML i place of DOM and get_elements_by_tabname() in place of getElementsByTagName().
But i read the DOMXML page and come to know that there should have php4.3 version for DOMXML. So Please, someone tell me that can i use upload xml file through php4.2.2

What is syntex for using DOMXML through php4.2.2

, Please illustrate through my example or any other simple example....
Thank you....
rapraj@reddifmail.com
iit kanpur