Praneet Srivastav
Praneet Srivastav

Reputation: 21

PHP variable not getting resolved in html page

I have a.php where I do a DB query and assign that to list like this..

list($A,$B)=mysql_fetch_row(mysql_query("SELECT A,B FROM configs WHERE idone=$v AND id='$inputid' LIMIT 1"));

            $p=array();
            $p=@explode(';,',base64_decode($A));
            $bg=$p[0];
            $A='';

            $i=0;
            foreach($p as $X){
                if(++$i>1) $A.='\''.str_replace(':-',':',$X).'\',';
            }

require'templates/inner_play.htm';

Now in inner_play.htm , I am using $A and $B from then above list like this..

 'image': '<?php echo $A?>',
 'URL' : '<?php echo $B ?>'

I can get the values for $A but $B does not resolve.? am i missing anything.?

Note: I can;t change the inner_play.htm to php as its part of bigger template system and I do get the value for $A in the same Htm but for some reason I am not getting $B.

Upvotes: 0

Views: 148

Answers (4)

Or you can setup server to run html as php:

Create a .htaccess file at the root of your website and add this line:

AddType application/x-httpd-php .html .htm

Upvotes: 0

Tschallacka
Tschallacka

Reputation: 28722

Rename inner_play.htm to inner_play.php.

Upvotes: 2

alwaysLearn
alwaysLearn

Reputation: 6950

change the extention to .php or .phtml simple htm extension can't understand the php code
Valid extension for php code are php and phtml

Upvotes: 0

Alvaro
Alvaro

Reputation: 41595

You are missing that .html files can not execute PHP functions sucha as echo.

You should rename your inner_play.htm to inner_play.php if you want to use any PHP inside.

Upvotes: 1

Related Questions