php - How to enter data to excel sheet through web form -


i trying create webform , storing submitted data in excel sheet
below html code saved as"update1.html"

<form action=xcel.php method="post"> <p> <lable>enter sample name</lable> <input type="text"  name="so">  <p> <lable>enter status</lable> <input type="text"  name="status"> </p>  <p><button>update</button></p> </form>   

and php script "xcel.php"

  <?php   $so_id=$_post['so'];  $status=$_post['status'];  require_once 'classes/phpexcel.php'; require_once 'classes/phpexcel/iofactory.php'; $objphpexcel = new phpexcel(); $objphpexcel->phpexcel_iofactory::load("asheet.xlsx"); $objphpexcel->setactivesheetindex(0); $objphpexcel->getactivesheet()->setcellvalue('a1', $so_id); $objphpexcel->getactivesheet()->setcellvalue('b1', $status);  $objwriter = phpexcel_iofactory::createwriter($objphpexcel, 'excel2007'); $objwriter->save("asheet.xlsx"); 

and in excel sheet i.e "asheet.xlsx" 2 column there "so" , "status".
need take user input web form , store in excel sheet how store data in database.
not getting proper formatted data in excel sheet.
this output getting further information feel free ask
in advance

ok, spoon-feeding time

either

<?php  $so_id=$_post['so']; $status=$_post['status'];  $fp=fopen("/var/www/html/apps/asheet.xlsx","w"); fputcsv($fp, array($so_id, $status), ';');  fclose($fp);  echo"thanks"; 

to write csv file ; delimiter, , pretend it's excel file

or

<?php  $so_id=$_post['so']; $status=$_post['status'];  require_once 'classes/phpexcel.php';  $objphpexcel = new phpexcel(); $objphpexcel->getactivesheet()->setcellvalue('a1', $so_id); $objphpexcel->getactivesheet()->setcellvalue('b1', $status);  $objwriter = phpexcel_iofactory::createwriter($objphpexcel, 'excel2007'); $objwriter->save("/var/www/html/apps/asheet.xlsx"); 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -