Page 1 of 1

Parse error (RESOLVED)

Posted: Fri Dec 16, 2005 11:02 pm
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?

Posted: Fri Dec 16, 2005 11:24 pm
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;
      ?>

Posted: Fri Dec 16, 2005 11:33 pm
by evilman
still get same error!

Posted: Fri Dec 16, 2005 11:35 pm
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;
      ?>

Posted: Fri Dec 16, 2005 11:53 pm
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"; 
   }

            ?>