I am using http://www.000webhost.com/ as a web server. My code works perfectly on the localhost but online I am getting this error
Parse error: syntax error, unexpected T_STRING in /home/a1582910/public_html/setcore/create.php on line 1
and I cannot fix it because I do not understand the problem because as you know the code is in one line all of it is in line one :D so
after searching i found that the names of the variables is case sensitive so i made it all in small letters and i still having the same error.
Can any one help?
I am using WAMPSERVER (32 BITS & PHP 5.4) create.php contains the following
<html>
<head>
</head>
<body>
<?php
class invoice {
function addninvoice ($i) {
require_once 'PHPExcel_1.7.9_doc/Classes/PHPExcel.php';
/** PHPExcel */require_once 'PHPExcel_1.7.9_doc/Classes/PHPExcel/IOFactory.php';
$excel2 = PHPExcel_IOFactory::createReader('Excel2007');
$excel2 = $excel2->load('try.xlsx');
$excel2->setActiveSheetIndex(0);
echo"".$excel2->getActiveSheet()->getHighestRow()."";
$psheet = $excel2->getActiveSheet();
$excel22 = PHPExcel_IOFactory::createReader('Excel2007');
$excel22 = $excel22->load('try.xlsx');
$psheet->setTitle($i);
$psheet->setCellValue('G7', $i);
$excel22->addSheet($psheet);
$obr = PHPExcel_IOFactory::createWriter($excel22, 'Excel2007');
$obr->save('try1.xlsx');
$excel222 = PHPExcel_IOFactory::createReader('Excel2007');
$excel222 = $excel222->load('try1.xlsx');
$o = PHPExcel_IOFactory::createWriter($excel222, 'Excel2007');
$o->save('try.xlsx');
}
}
$p=new invoice;
$in = $_GET['in'];
require_once 'PHPExcel_1.7.9_doc/Classes/PHPExcel/IOFactory.php';
$excel2 = PHPExcel_IOFactory::createReader('Excel2007');
$sna = $excel2->listWorksheetNames("try.xlsx");
$df=0;
foreach($sna as $id => $name ){
if($name==$in){ $df++; }
}
if($df != 0){
echo"this invoice already exist
you can not create two invoices with the same name
if you want to edit it just click on it from the left menu in the home page" ;
}else{
$p->addninvoice($in);
?><meta http-equiv="Refresh" content="0; url=fa.php"><?php
}
?>
</body>
</html>
fa.php
<html>
<head>
<script>
function validateForm()
{
var x=document.forms["numrownamche"]["in"].value;
if (x==null || x=="")
{
alert("Invoice Name Must Be Filled Out");
return false;
}
}
</script>
</head>
<body bgcolor="silver">
<img src="image/Logo.gif" alt="Setcore" width="199">
<b>create new invoice</b>
<form name="numrownamche" action="create.php" onsubmit="return validateForm()" method="get">
<br/><small>invoice number:</small> <input type="text" name="in">
<input type="submit" value="Create">
</form>
<?php
require_once 'PHPExcel_1.7.9_doc/Classes/PHPExcel/IOFactory.php';
$excel2 = PHPExcel_IOFactory::createReader('Excel2007');
$sna = $excel2->listWorksheetNames("try.xlsx");
foreach($sna as $id => $name ){
?>
<a href="fb.php?shtid=<?php echo $id; ?>" target="fb"><?php echo "".$name."<br/>";?> </a>
<?php
}
?>
</body>
</html>