Parse error (RESOLVED)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
evilman
Forum Newbie
Posts: 7
Joined: Mon Oct 10, 2005 12:18 am

Parse error (RESOLVED)

Post by evilman »

Ok guys, I am trying to make it so when a person goes to index.php?update=pass or ?update=email it tells them a message.

I came up that The best way to do this is:

Code: Select all

<?php
		if ($_GET['update'] == pass)
	echo "<font color='green'>Password Updated!</font>\n";
	{
	if ($_GET['update'] == email)
	echo "<font color='green'>E-Mail Address Updated!</font>\n";
	exit;
		?>
but it returns: Parse error: parse error, unexpected $ in /home/rootdet/public_html/bfa/cp/index.php on line 210

Surprisingly, this staretd after i was coding this. on line 210 is the </html> tag!

Any thoughts?
Last edited by evilman on Fri Dec 16, 2005 11:54 pm, edited 1 time in total.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

You have an echo statement between your if and your opening bracket:

Code: Select all

<?php
      if ($_GET['update'] == pass)
echo "<font color='green'>Password Updated!</font>\n";
   {
   if ($_GET['update'] == email)
   echo "<font color='green'>E-Mail Address Updated!</font>\n";
   exit;
      ?>
Should Be:

Code: Select all

if ($_GET['update'] == pass)
   {
echo "<font color='green'>Password Updated!</font>\n";
   if ($_GET['update'] == email)
   echo "<font color='green'>E-Mail Address Updated!</font>\n";
   exit;
      ?>
evilman
Forum Newbie
Posts: 7
Joined: Mon Oct 10, 2005 12:18 am

Post by evilman »

still get same error!
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Sorry I saw the one error and quit looking....

you have pass and email but neither are a variable or a string. If they are a variable they need to be $pass and $email If they are a string the need quotes. 'pass' and 'email''

Code: Select all

if ($_GET['update'] == $pass)
   {
echo "<font color='green'>Password Updated!</font>\n";
   if ($_GET['update'] == $email)
   echo "<font color='green'>E-Mail Address Updated!</font>\n";
   exit;
      ?>
evilman
Forum Newbie
Posts: 7
Joined: Mon Oct 10, 2005 12:18 am

Post by evilman »

Finally got it!

Code: Select all

<?php
  if ($_GET['update'] == 'pass') 
   { 
echo "<font color='green'>Password Updated!</font>\n"; 
}
   if ($_GET['update'] == 'email') {
    echo "<font color='green'>E-Mail Address Updated!</font>\n"; 
   }

            ?>
Post Reply