-3

I have simplified the code to the basics and I get the same error.

!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <?php if ('b'=='b') {
        if ('a'=='a'):?> 
             <a href="index_login.php">New Page</a>  
        <?php endif; ?>
    }     
</body>
</html>
marsheng
  • 51
  • 1
  • 9
  • 2
    You have a `` in the middle of you code. If you remove it, it would work better. – laurent Jul 10 '17 at 10:45
  • 2
    @this.lau_ Its the `?>` closing that line, its cuts off the rest of the script. – Flosculus Jul 10 '17 at 10:47
  • @this.lau_ That `endif` belongs to an `if`…! – deceze Jul 10 '17 at 10:47
  • It would appear that the if with the endif breaks the parameter association with netbeans. Or I'm doing it wrong? If I take the code listed below, it shows the basic code works and the associations now also work. Hence the posting, I'm stuck. – marsheng Jul 10 '17 at 11:05
  • If I replace the 3 lines with the below, it works. I would still like to know why the original code does not work. It will catch me out some time later. if ($_SESSION['Password'] == $_POST['Password']){ header("Location: mem_page.php"); exit; } – marsheng Jul 10 '17 at 11:25
  • How do post code in a comment ? – marsheng Jul 10 '17 at 11:26

1 Answers1

0

Try this

<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {     
    if (!empty($_POST['LicenceNo']) && $_SESSION['MEMID'] == '')  {
        require ('sql_get_MNZID.php');                       
    }else { 
        if(isset($_SESSION['Password']) && isset($_POST['Password'])){                
            if ($_SESSION['Password'] == $_POST['Password']){
                echo '<a href="index_login.php">New Page</a>';    
            }  
        }
    }
}else{
    $_SESSION['MEMID'] = '';
    $_SESSION['Password'] = '';   
    $_SESSION['MemName'] = '';
}    
?>

**Modification:-**To redirect to another page then replace this

if ($_SESSION['Password'] == $_POST['Password']){
          echo '<a href="index_login.php">New Page</a>';    
} 

with this

if ($_SESSION['Password'] == $_POST['Password']){
        echo '<script type="text/javascript">location.href = "index_login.php";</script>';  
} 

It will work for you.

This works

if ($_SESSION['Password'] == $_POST['Password']){
    header("Location: mem_page.php");      
    exit;                        
} 
marsheng
  • 51
  • 1
  • 9
Bibhudatta Sahoo
  • 4,808
  • 2
  • 27
  • 51