Search code examples
phphtmlphp-parse-error

PHP Error : Parse error: syntax error, unexpected '<' in filename.php


I have three buttons , Edit remove and view .. on view part i am trying to echo the row ID in order to fetch details . But i get this parse error .

Here is the Code :

 while( $row=mysqli_fetch_array($query) ) { 
 $active = '';
 if($row['active'] == 1) {
    $active = '<label class="label label-success">Complete</label>';
 } else {
    $active = '<label class="label label-danger">Incomplete</label>'; 
 } 


 $actionButton = '
<div class="btn-group">
  <button type="button" class="btn btn-default dropdown-toggle" data-     toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Action <span class="caret"></span>
  </button>
  <ul class="dropdown-menu">
    <li><a type="button" data-toggle="modal" data-backdrop="static" data-keyboard="false"  data-target="#editMemberModal"  onclick="editMember('.$row['id'].')"> <span class="glyphicon glyphicon-edit"></span> Edit</a></li>
    <li><a type="button" data-toggle="modal" data-target="#removeMemberModal" onclick="removeMember('.$row['id'].')"> <span class="glyphicon glyphicon-trash"></span> Remove</a></li>
    <li><a class="view_data"  type="button" data-toggle="modal"   data-target="#dataModal" id="'.<?php echo $row['id']; ?>.'"><span class="glyphicon glyphicon-trash"></span> View</a></li> 
  </ul>
</div>
    ';

Am facing this error on the dropdown menu third list .. class is view_data


Solution

  • Check your last li change it as per below:

    <li><a class="view_data"  type="button" data-toggle="modal"   data-target="#dataModal" id="' . $row['id'] . '"><span class="glyphicon glyphicon-trash"></span> View</a></li>
    

    Also in above code ending } is missing at last