0

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???
2
Contributors
1
Reply
11
Views
2 Years
Discussion Span
Last Post by pixelsoul
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.