-1

i try to show random url with php i write this code but when i run i got page not found can you please fix this bug? my code is

  <?php


   $the_array = array( "https://ikman.lk", "http://www.w3schools.com", "https://www.google.lk", "https://www.giga-rdp.ca","http://tamilfreemovies.com/", "https://actproxy.com", "https://www.webmasterworld.com", "http://stackoverflow.com" ); 
    shuffle($the_array);
    $page = $the_array[0];

    $ctr =100;
    if (rand (0,100) <= $ctr)
    {
    $control="si";
    }
    else {
    $control="no";
    }

    if(($control=="si") ) {
    echo '<iframe align="center" width="100%" height="100%" src="$page" frameborder="yes" scrolling="yes" name="myIframe" id="myIframe"> </iframe>';
    }

    ?>

1 Answers1

2

should be src="'.$page.'" not src="$page"

<?php
   $the_array = array( "https://ikman.lk", "http://www.w3schools.com", "https://www.google.lk", "https://www.giga-rdp.ca","http://tamilfreemovies.com/", "https://actproxy.com", "https://www.webmasterworld.com", "http://stackoverflow.com" ); 
    shuffle($the_array);
    $page = $the_array[0];

    $ctr =100;
    if (rand (0,100) <= $ctr)
    {
    $control="si";
    }
    else {
    $control="no";
    }

    if(($control=="si") ) {
    echo '<iframe align="center" width="100%" height="100%" src="'.$page.'" frameborder="yes" scrolling="yes" name="myIframe" id="myIframe"> </iframe>';
    }
SML
  • 1,235
  • 6
  • 17