ballhogjoni Posted April 14, 2007 Share Posted April 14, 2007 I am getting this error: Parse error: syntax error, unexpected '{', expecting '(' in /home/realfina/public_html/tests/school/test.php on line 6 <?php $totalDollarsAvailable = $_GET['totalDollarsAvailable']; if (isset($totalDollarsAvailable)) { echo ""; } elseif { $dollarsPerDay = $totalDollarsAvailable / 7; while ($dollarsPerDay >= 100) { echo "The answer is: ".$dollarsPerDay; } else { if ($dollarsPerDay < 100) { echo "You better search for a bargain vacation"; } } } ?> <form action="" method="GET"> <input type="text" size="20" name="totalDollarsAvailable"> <br> <input type="submit" value=" Submit "> <br> Quote Link to comment https://forums.phpfreaks.com/topic/47027-solved-easy-fixhelp-please/ Share on other sites More sharing options...
Guest prozente Posted April 14, 2007 Share Posted April 14, 2007 elseif requires a condition, if you don't have one then change your code Quote Link to comment https://forums.phpfreaks.com/topic/47027-solved-easy-fixhelp-please/#findComment-229346 Share on other sites More sharing options...
kenrbnsn Posted April 14, 2007 Share Posted April 14, 2007 This line <?php } elseif { ?> should be <?php } else { ?> But you code will not work as written, try this instead: <?php if (isset($_GET['totalDollarsAvailable'])) { $dollarsPerDay = $_GET['totalDollarsAvailable'] / 7; if ($dollarsPerDay >= 100) echo "The answer is: ".$dollarsPerDay; else echo "You better search for a bargain vacation"; } ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/47027-solved-easy-fixhelp-please/#findComment-229347 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.