PHP: Set variable in to include file in 'if' statement
Posted
by
swiftsly
on Stack Overflow
See other posts from Stack Overflow
or by swiftsly
Published on 2013-10-23T21:50:23Z
Indexed on
2013/10/23
21:54 UTC
Read the original article
Hit count: 170
php
I am trying to set a variable in an 'if' statement so that only when the 'if' statement is true, the variable will be set and will be able to be used somewhere else on the page.
Here's what I have tried:
if ($row[8] == 1) {
echo 'Message here';
ob_start();
include('F164.php');
$f164 = ob_get_clean();
}
as well as:
if ($row[8] == 1) {
echo 'Message here';
$f164 = include('F164.php');
}
© Stack Overflow or respective owner