0

i am having some king of error on my code if you test i get syntax error on line 7 and this is part of my code. i am trying to put php inside php code

<?php
$stringData = "

    <div > " .$strin. " </div>

    <?php
    $width = $_GET['width'];
    $heigh = $_GET['height'];

        echo '<script type=\"text/javascript\" src=\"example.com/page.php?width='.$width.'&height='.$heigh.'\"></script>';

    ?>

    ";
?>

my code forwards the php code that is inside another php to aanother page but i don't know how do i put it currectly inside php. i used \" on some places

Mm Pp
  • 227
  • 3
  • 9

1 Answers1

0

replace

<?php
$stringData = "

    <div > " .$strin. " </div>

    <?php
    $width = $_GET['width'];
    $heigh = $_GET['height'];

        echo '<script type=\"text/javascript\" src=\"example.com/page.php?width='.$width.'&height='.$heigh.'\"></script>';

    ?>

    ";
?>

and use the following:

$stringData = "<div > " .$strin. " </div>";
$width = $_GET['width'];
$heigh = $_GET['height'];
echo '<script type="text/javascript" src="example.com/page.php?width='.$width.'&height='.$heigh.'"></script>';
Shakti Phartiyal
  • 6,156
  • 3
  • 25
  • 46