0

Good morning, I'm having problems when I execute my code, I think I'm having problems with the quotes, etc.

So far this is what I've tried and I'm stil having syntax error with this specific line of codes.

$message .= "if ($row['status']) :
          $output .= '<td>'.$row["status"].'</td> ';
       else:
          $output .= '
                <td>
                    <form method="post" action="update-request-status.php">
                        <input type="hidden" name="reqnumber" value="'.$row['reqnumber'].'" />
                        <button class="button" type="submit" name="completed" value=""><span>New Request!</span></button>
                    </form>
                </td>";

Here's what it looks like right now:

Summary

Error

Wade Boar
  • 15
  • 6

2 Answers2

1

You have the logic and the quotes wrong, maybe this is what you want :

if ($row['status']) :
            $output .= '<td>'.$row["status"].'</td> ';
            else:
            $output .= '
            <td>
                <form method="post" action="update-request-status.php">
                    <input type="hidden" name="reqnumber" value="'.$row['reqnumber'].'" />
                    <button class="button" type="submit" name="completed" value=""><span>New Request!</span></button>
                </form>
            </td>';
endif;
$message .= $output;
Hasta Dhana
  • 4,699
  • 7
  • 17
  • 26
0

As Hasta Dhana had answered, here is some detail about why he change the code completely.

this code you use

$message .= "if ($row['status']) :
          $output .= '<td>'.$row["status"].'</td> ';
       else:
          $output .= '
                <td>
                    <form method="post" action="update-request-status.php">
                        <input type="hidden" name="reqnumber" value="'.$row['reqnumber'].'" />
                        <button class="button" type="submit" name="completed" value=""><span>New Request!</span></button>
                    </form>
                </td>";

make your $message output exactly how you write the code, because php doesn't define is as process code. this "" is to inform the php code processor that what you write is string not process. Also please refer INFO to learn more about how to use html in php.

After Edit can you check the spelling of your array.

Fzstyle
  • 83
  • 1
  • 11