stickynote427 Posted April 23, 2010 Share Posted April 23, 2010 I have a feedback form on my site. It was working yesterday, I think, but last night I backed up all of the files on the site because I was be going to make some major changes to them that I wasn't sure would work (so far all is going well, though). After working on the changes for a while, I wanted to change a little something on the feedback form. After I did that, when I try loading the form, I get this: Parse error: syntax error, unexpected '}' in /some/directory/here/feedback.php on line 1 After trying to fix this last night, and some this morning, I decided to just restore the backup I made last night, as I didn't make any huge changes to the feedback form and no work would be lost by restoring it. After restoring, it still doesn't work. I get the same error. I am confused, though, because there isn't even a right curly bracket on line 1 in feedback.php. <?php session_start(); $pageTitle = "Send Feedback"; require_once( "include.php" ); if ( isset($_POST['feedbackSubmit']) ) { $to = "[email protected]"; $from = $_POST['name']." <".$_POST['email'].">"; $subject = "Feedback from ".$_SERVER['REMOTE_ADDR']; $message = "Name: ".$_POST['name']."\nUsername: ".$_POST['username']."\nEmail: ".$_POST['email']."\nTopic: ".$_POST['topic']."\nMessage:\n".$_POST['message']; $headers = "From: ".$from; if ( mail($to, $subject, $message, $headers) ) { echo "<p>Your message was delivered successfully.</p>"; } else { echo "<p>There was an error delivering your message. Please go back and try again.</p>"; } } else { ?> <p>Please fill out the form below to leave feedback about the game.</p> <table> <form name="feedbackForm" method="POST" action="<?=$_SERVER['PHP_SELF'];?>"> <tr><td>Name:</td><td><input type="text" name="name"/></td></tr> <tr><td>Username:</td><td><input type="text" name="username"/></td></tr> <tr><td>Email:</td><td><input type="text" name="email"/></td></tr> <tr><td>Topic:</td><td><select name="topic"> <option value="bug report">Bug report</option> <option value="option/feature suggestion">Option/feature suggestion</option> <option value="question">Question</option> <option value="other">Other</option></select></td></tr> <tr><td>Message:<br/><textarea name="message" cols="20" rows="10"></textarea><br/><input type="submit" name="feedbackSubmit" value="Send"/></td></tr> </form> </table> <?php } ?> </div> </body> </html> I've tried commenting out the require_once() part, but that doesn't solve the problem. That page is used on many other pages on my site, and those pages work fine, so it shouldn't be a problem with that anyways. Any ideas? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/199488-unexpected-on-line-where-it-doesnt-exist/ Share on other sites More sharing options...
ScotDiddle Posted April 23, 2010 Share Posted April 23, 2010 Stickynote427, I loaded your posted code into my IDE and it did not throw any syntax errors... Perhaps your browser is pickup up a cached copy of older (broken) code. Try clearing your browser temporary files. Also, add: <?php header("Expires: Mon, 11 Oct 2004 05:00:00 GMT"); Header("Cache-control: private, no-cache"); Header("Pragma: no-cache") ?> to a copy ( new name ) of your code, and try running that version as see what happens. Scot L. Diddle, Richmond VA Quote Link to comment https://forums.phpfreaks.com/topic/199488-unexpected-on-line-where-it-doesnt-exist/#findComment-1046992 Share on other sites More sharing options...
stickynote427 Posted April 23, 2010 Author Share Posted April 23, 2010 I cleared my cache, but I still receive the same error. (A different browser, which would not have a cached copy like that, also produces the same results.) I added the header info to very top of the page (after the <?php on line 1) and I receive unexpected T_STRING instead. Quote Link to comment https://forums.phpfreaks.com/topic/199488-unexpected-on-line-where-it-doesnt-exist/#findComment-1046995 Share on other sites More sharing options...
PFMaBiSmAd Posted April 23, 2010 Share Posted April 23, 2010 Download feedback.php from your server (saving it as a different file name so as to not overwrite any existing good file) and examine exactly what is in it. Quote Link to comment https://forums.phpfreaks.com/topic/199488-unexpected-on-line-where-it-doesnt-exist/#findComment-1047000 Share on other sites More sharing options...
stickynote427 Posted April 23, 2010 Author Share Posted April 23, 2010 Ah, I see. Everything appears to be squished on one line. I don't know why that would happen, though. :-/ It also seems my FTP client (FileZilla) wasn't correctly/successfully transferring the file. When I tried transferring the file once, it popped up with a window verifying that I wanted to overwrite the current file; it said the new file size was 1.5something KB and the old file was 1.4something. After transferring it again, the old file size didn't change to the new file size like it should have. I logged in to my hosting control panel in my browser and tried uploading it there; now it works fine. Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/199488-unexpected-on-line-where-it-doesnt-exist/#findComment-1047006 Share on other sites More sharing options...
oni-kun Posted April 23, 2010 Share Posted April 23, 2010 Ah, I see. Everything appears to be squished on one line. I don't know why that would happen, though. :-/ It also seems my FTP client (FileZilla) wasn't correctly/successfully transferring the file. When I tried transferring the file once, it popped up with a window verifying that I wanted to overwrite the current file; it said the new file size was 1500something and the old file was 1400something. After transferring it again, the old file size didn't change to the new file size like it should have. I logged in to my hosting control panel in my browser and tried uploading it there; now it works fine. Thanks for your help! Sounds like a case of crossOSnewlineitus. Quote Link to comment https://forums.phpfreaks.com/topic/199488-unexpected-on-line-where-it-doesnt-exist/#findComment-1047008 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.