Jump to content

[SOLVED] easy fix...help please


ballhogjoni

Recommended Posts

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>

 

Link to comment
https://forums.phpfreaks.com/topic/47027-solved-easy-fixhelp-please/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.