mtorro Posted May 14, 2009 Share Posted May 14, 2009 Hi all I am a newbie to php and can't understand why if it works on my local sever why won't this code work when hosted?. A fix would be most helpful. see code below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>sr_results</title> <script src="/a14/js/jquery-1.2.6.min.js" type="text/javascript" charset="utf-8"></script> <script src="/a14/js/widget.js" type="text/javascript" charset="utf-8"></script> <link href="/a14/screen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="midground"></div> <div id="foreground"></div> <div id="background"> <!-- WRAPPER START--> <div id="wrapper"> <!-- NAVIGATION --> <div id="navlist"> <h1><a href="/a14/index.html" title="Take me home!"></a></h1> <ul> <li><a href="/a14/name.html">Mission one<br/><span>Name the Shape</span></a></li> <li><a href="/a14/sr_questions.html">Mission two<br/><span>Shape Rescue</span></a></li> <li><a href="/a14/rocket.html">Mission three<br/><span>Make a Rocket</span></a></li> <li><a href="/a14/parallel.html">Mission four<br/><span>Parallel Universe</span></a></li> <li><a href="/a14/contact_last.html">Mission control<br/><span>Contact</span></a></li> </ul> </div> <!-- MAIN CONTENT START --> <div id="content"> <!-- Column One --> <div id="result"> <?php $score = 0; if ($_POST['q1'] == 'no') $score++; if ($_POST['q2'] == 'yes') $score++; if ($_POST['q3'] == 'yes') $score++; if ($_POST['q4'] == 'no') $score++; if ($_POST['q5'] == 'no') ?> <?php echo '<h2><span>You have saved ' . $score . ' out of 5 shapes</span></h2><br><br>'; if ($score < 4) echo '<h5>The Shape Alien has taken the shapes!</h5>'; else if ($score == 5) echo '<h5>Well done, all the shapes are safe!</h5>'; else echo '<h5>Not bad, try again</h5>'; ?><?php <ul> <li><a href="/a14/sr_questions.html"id="tryagain-button">Try again</a></li> <li><a href="/a14/rocket.html" id="next-button">Next Mission</a></li> </ul> </div> <!-- MAIN CONTENT END --> </div> <!-- WRAPPER END--> </div> <!-- background END--> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/158178-parse-error-syntax-error-unexpected-t_variable-on-line1/ Share on other sites More sharing options...
timmah1 Posted May 15, 2009 Share Posted May 15, 2009 I don't see anywhere that a form is being sent to the page it could be this line echo '<h5>Not bad, try again</h5>'; ?><?php Take out the <?php, no need for it Also, post your code in code /code brackets, much easier to see Link to comment https://forums.phpfreaks.com/topic/158178-parse-error-syntax-error-unexpected-t_variable-on-line1/#findComment-834503 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.