Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

external PHP to HTML?

Hello!!

I have this simple external php code and I want to print the image from the HTML.

<?php

echo date("d m Y");

echo date("G i s");

$sec=date("s");

if ($sec>30)

{

echo '<img src="2.jpg"/>';

}

else

{

echo '<img src="1.jpg"/>';

}

?>

<head>

<script type="text/javascript" src="new.php"></script>

</head>

<body>

'<I WANT TO PRINT THE IMAGE HERE>'

</body>

Any ideas??? thank you!!!!

</html>

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    Try this:

    <?php

    echo date("d m Y");

    echo date("G i s");

    $sec=date("s");

    if ($sec>30)

    {

    $imagechosen = '2.jpg';

    }

    else

    {

    $imagechosen = '1.jpg';

    }

    ?>

    <head>

    <script type="text/javascript" src="new.php"></script>

    </head>

    <body>

    <img src="<?php echo $imagechosen; ?>" />

    </body>

    Any ideas??? thank you!!!!

    </html>

  • 1 decade ago

    yes -just move it there!

Still have questions? Get your answers by asking now.