How to read an excel file in php?

This is my index page:::

<html>
<head>
</head>
<body>
<form method="post" action="save_category.php" enctype="multipart/form-data">

                <label >Import File<span class="mandatory">*</span></label>

                <input type="radio"  name="file" value="1" checked>Excel File&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio"  name="file" value="0">CSV File
                <input type="file"   name="import" value="Import" required/> 

                <label >Book Category Name<span class="mandatory">*</span></label>

                <input type="text" id="categoryname" name="categoryname" placeholder="Book Category Name" autofocus required>

                <label >Description<span class="mandatory">*</span></label>

                <input type="text" id="description" name="description" placeholder="Description" required>


                <label >Rack No<span class="mandatory">*</span></label>

                <input type="text" id="rackno" name="rackno" placeholder="Rack No" onKeyPress="return numbersonly(event);"required>



                <button type="submit"  >Submit</button>
                <button type="reset" >Reset</button>

                </form>  
                </body>
                </html>



This is my save page::
<?php
include('connect.php');
$file=$_POST['file'];
$name=$_POST['categoryname'];
$desc=$_POST['description'];
$rack=$_POST['rackno'];
mysql_query("insert into tbl_category(categoryname,descriptionail,rackno)values('$name','$desc','$phone','$rack')") or die(mysql_error());
echo "<script type='text/javascript'>alert('Data Inserted Successfully'); window.location.href='import.php';</script>";
?>

 Here How to read an excel file???
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.