PHP Parse Syntax Error

richm8026

New Member
Messages
138
Reaction score
0
Points
0
This is the Error Message I am getting:

Parse error: syntax error, unexpected $end in /home/rick8027/public_html/index.php on line 42

Can anybody go here and tell me what I can do to fix this???\\

www.x01hosting.com/index.html thanks for the help

here's the stuff in my PHP file at the bottom of it

I don't see anything about $end in there..

<html>

<head>

<title> See Your Calcuation Results </title>

</head>

<body>

<p> The Answer for the calculation is: <? echo "$result"; ?></p>

</body>

</html>
 

quantum1

New Member
Messages
68
Reaction score
0
Points
0
I believe your

<? echo "$result"; ?>

should be

<?php echo "$result"; ?>
 

natsuki

New Member
Messages
112
Reaction score
0
Points
0
The most common thing to know about errors especially parse errors is that:

The error is either in the error line or above that and NEVER after.

You should check what comes in before that line... it says line 42 so there must be 41 lines before that.
 
Last edited:

richm8026

New Member
Messages
138
Reaction score
0
Points
0
Thanks, I noticed what I did wrong, but now it doesn't go to the index.php file, it was supposed to be a basic Calculator, and you type in two numbers and it's supposed to reload into the php file displaying the results, all it does is goes back to the index.html file, any help with that?? I'm sure you can view the source, I know you can't view the PHP syntax using the browser....
 

natsuki

New Member
Messages
112
Reaction score
0
Points
0
There's no way to view a php file using the browser, just post it in.
 

quantum1

New Member
Messages
68
Reaction score
0
Points
0
If you have index.html and index.php in the same directory, I believe if a visitor goes to your site and does not specify a file (www.blahblah.com as opposed to www.blahblah.com/index.php) then it will find the index.html first. The information below is from the cpanel getting started wizard in the Introduction to Web Hosting section:

When someone views a directory in your public_html area, they will see the index page for that directory. When creating your index page, you should use one of the following names (the first one found will be shown if the visitor doesn't type in a specific page in their URL):
index.htm
index.html
index.shtml
index.xhtml
index.wml
index.perl
index.pl
index.plx
index.ppl
index.cgi
index.jsp
index.js
index.jp
index.php4
index.php3
index.php
index.phtml
default.htm
default.html
home.htm
index.php5
Default.html
Default.htm
home.html
 

Jake

Developer
Contributors
Messages
4,057
Reaction score
5
Points
0
rename your index.html -> index_backup.html and make sure you sitll have the index.php in the directory. Go to the URL... if you get that error again, first off you dont need "" around <?php echo $result; ?> and please post the code on and around line 42.
 
Top