Go Back   CodeCall Programming Forum > Web Development Forum > PHP Forum
Register Blogs Search Today's Posts Mark Forums Read

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-07-2009, 02:54 PM
Newbie
 
Join Date: Jul 2009
Posts: 1
crd06c is an unknown quantity at this point
Unhappy PHP Parse Error

I dont know where im going wrong.

Can anyone help? This is my first time programming with PHP.

PHP Code:
<body>
<div id="container">
  <div id="mainContent">
    <h1> College Progress Calculator</h1>
<?php

$total_credits 
120;
$credits_earned $_POST["credits_earned"];
$name $_POST["name"];
$credits_remaining $total_credits $credits_earned;
$percent_gone $credits_remaining $total_credits;

echo 
"<p>Hi " $name "!</p>";
echo 
"<p> Wow! You've already completed "$credits_earned " hours!</p>";
echo 
"<p> Only " credits_remaining " to go!</p>";
echo 
"<p> You have completed " $percent_gone " of your undergraduate degree.</p>";

if (
$percent_gone .3){
    echo 
"<p>That Makes you a Freshman!</p>";
}
elseif (
$percent_gone .6){
    echo 
"<p>That makes you a Sophomore!</p>";
}
elseif (
$percent_gone .9 
    echo 
"<p>That makes you a Junior!</p>";
}
elseif (
$percent_gone 1.0 
    echo 
"<p>You are ready to GRADUATE!!!</p>";
}

?>
<p>&nbsp;</p>
</div>
</div>
</body>
</html>
Im trying to create a calculator.
Its for my programming course.

Last edited by Jordan; 07-07-2009 at 03:00 PM.. Reason: Added code tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-07-2009, 03:05 PM
Jordan's Avatar
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 24,556
Jordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to all
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan Send a message via Yahoo to Jordan
Re: PHP Parse Error

Hey crd06c, welcome to the forum! I've added code tags to your post so that it is easier to see. If you post code again, please do the same.

If you look at lines 24 and 27 you'll see that you forgot your ending ) on the condition. You also are making an assignment statement on line 27 instead of testing the condition. Use double ==

PHP Code:
elseif ($percent_gone == 1.0) { 
On line 15 you are missing the dollar sign from your variable credits_remaining. That should fix it up.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-23-2009, 03:15 AM
sdavis2702's Avatar
Learning Programmer
 
Join Date: Aug 2009
Location: Fort Sill, Oklahoma
Age: 25
Posts: 95
sdavis2702 is an unknown quantity at this point
Send a message via AIM to sdavis2702 Send a message via Yahoo to sdavis2702
Re: PHP Parse Error

Also, shouldn't line 11 be...

PHP Code:
$percent_gone $credits_earned $total_credits
Instead of...

PHP Code:
$percent_gone $credits_remaining $total_credits
...to show what has been completed (percent_gone)? I copied and pasted this snippet and played around with it on my own computer and found that the calculator was giving more of an inversely proportional reading of credits completed to class year ratio. What I mean is, those who had earn more credits were freshmen and sophomores and those who earn less credits were juniors and seniors.

Am I correct or still confused about how everything works? lol
__________________
My Name is Sean and I like codes and stuff...
NoobJunction.com | SuccessOnMyMind.com | ArmedForcesCarClub.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-23-2009, 10:23 AM
Jordan's Avatar
Administrator
 
Join Date: Nov 2005
Location: Hendersonville, NC
Posts: 24,556
Jordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to allJordan is a name known to all
Send a message via ICQ to Jordan Send a message via AIM to Jordan Send a message via MSN to Jordan Send a message via Yahoo to Jordan
Re: PHP Parse Error

Sounds logically correct to me! (your correction, that is)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
parse error in php amrosama PHP Forum 8 05-03-2009 04:07 PM
need urgent help finding parce error!!! siren C and C++ 3 09-13-2007 10:45 AM
Php - CGI Error thesquirrel16 General Programming 1 05-19-2007 06:09 PM
can someone help me with my c librarys? bobwrit C and C++ 4 04-27-2007 07:19 PM


All times are GMT -5. The time now is 10:34 AM.


vBulletin v3.8.0 ©2010, Jelsoft Enterprises Ltd.


no new posts

LinkBacks Enabled by vBSEO 3.1.0