php - a syntax error shows on hosting and the same code works just fine on the local -


i using http://www.000webhost.com/ web server. code works on localhost online getting error

parse error: syntax error, unexpected t_string in /home/a1582910/public_html/setcore/create.php on line 1

and cannot fix because not understand problem because know code in 1 line of in line 1 :d

after searching found names of variables case sensitive made in small letters , still having same error.

can 1 help?

i using wampserver (32 bits & php 5.4) create.php contains 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 $id => $name ){     if($name==$in){ $df++; }          }     if($df != 0){     echo"this invoice exist    can not create 2 invoices same name    if want edit click on left menu in 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 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 $id => $name ){        ?>     <a href="fb.php?shtid=<?php echo $id; ?>" target="fb"><?php echo "".$name."<br/>";?>                        </a>         <?php              }          ?>          </body>       </html> 

try adding empty

<?php ?> 

to beginning of file, before <html> tag. i'm not sure why, i've noticed fixes problems mixed php/html.

additionally, null byte or other invisible char creeps in before start tag, depending on file encoding/editor used/copy & paste, etc. try deleting entire first line , re-typing , see if fixes problem.


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -