-1

I am getting this error:

Parse error: syntax error, unexpected '!=' (T_IS_NOT_EQUAL) in C:\xampp\htdocs\assurance\confirmation.php on line 131

Here is lines 131-134 of my code:

if ($_POST['password']) != ($_POST['confirm'])  { 
echo '<p class="error">Your passwords do not match.</p>';
$okay = FALSE;
}
JJJ
  • 31,545
  • 20
  • 84
  • 99
  • 2
    Remove the extra parentheses. Your code should be: `if ($_POST['password'] != $_POST['confirm'])`. – Amal Murali Feb 15 '14 at 16:01
  • 1
    `if ($_POST['password'] != $_POST['confirm'])` – BlitZ Feb 15 '14 at 16:01
  • 1
    Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. – James Feb 15 '14 at 16:01

2 Answers2

1
if ($_POST['password'] != $_POST['confirm'])  { 
echo '<p class="error">Your passwords do not match.</p>';
$okay = FALSE;
}

the syntax of the if statement is

if (expr)
  statement

See http://www.php.net/manual/en/control-structures.if.php

Aris
  • 3,804
  • 1
  • 31
  • 33
1

use this

if ($_POST['password'] != $_POST['confirm'])  { 
    echo '<p class="error">Your passwords do not match.</p>';
    $okay = FALSE;
}
Dima
  • 8,448
  • 4
  • 25
  • 56