Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2009
    Posts
    69
    Thanks
    5
    Thanked 0 Times in 0 Posts

    PHP / MYSQL > iFrame - Load multiple

    Hello,

    Hope someone can assist
    I currently have a table where each <tr> repeats itself with information pulled from MYSQL. Each <tr> also contains several iframes, and I have a single link that loads each iframe at a certain time (giving enough time for each one to do what it needs to before the next one starts)

    This works flawlessly, but I was really hoping that someone might be able to suggest as to how I can make it so that each time I click a link (should be only once if this idea is feasible), it loads all the iframes one by one.

    So, each <tr> link has to load iframe1 iframe and then iframe3. Each iFrame has a unique name according to the infro pulled from the MYSQL, this way no iFrame has the same name and each set of links is unique.

    As I said, this works flawlessly, but I want to be able to click the link ONCE and it then goes through its cycle of loading iframe1 iframe2 iframe3 for the first <tr>, then to continue to the next <tr> iframe1 iframe2 and iframe3, so on and so forth.

    Each iframe has to finish loading before the next one starts to do the way the destination website is designed, so if iframe1 loads in more than one <tr> at a time, it will only perform the needed action for the last item. iframe2 and iframe3 cannot load without iframe1 being complete becaue it returns results for iframe1.

    If iframe1 loads in all columns, iframe2 and iframe3 will load the same info (last action from last <tr>) which is not what is needed.

    This is the code that I have so far:

    Any help would be greatly appreciated

    PHP Code:
    <table cellpadding="0" cellspacing="0" class="new">
    <?php
            
    include("../config.php");
            
    $result mysqli_query($connect,"SELECT * FROM new ORDER BY idnum ASC");
            while(
    $newrow mysqli_fetch_assoc($result))
                 {
                   
                    
    $codeinput $myrow['code'];
                    
    $codesearch = array("123");
                    
    $codereplace = array('abc');  
                    
    $codeout str_replace($codesearch$codereplace$codeinput);
                    
                    
    $fnameinput $myrow['firstname'];
                    
    $fnamesearch = array(" ");
                    
    $fnamereplace = array('');  
                    
    $fnameout str_replace($fnamesearch$fnamereplace$fnameinput);
                    
                    
    $lnameinput $myrow['lastname'];
                    
    $lnamesearch = array(" ");
                    
    $lnamereplace = array('');  
                    
    $lnameout str_replace($lnamesearch$lnamereplace$lnameinput);

                   echo 
    "<tr class=\"\">";
                   echo 
    "<td class=\"idnum\" >".$myrow['idnum']."</td>";
                   echo 
    "<td class=\"name\" >".$fnameout."&nbsp;".$lnameout."</td>";
                   echo 
    "<td class=\"code\" >".$myrow['code']."</td>";
                   echo 
    "<td class=\"action\" >";
                   echo 
    "<script>function func".$fnameout.$lnameout.$codeout.$myrow['idnum']."() {
                         setTimeout('window.open(\'test.php?fName="
    .$fnameout."&lName=".$lnameout."&code=".$codeout."&lang=en\',\'create".$fnameout.$lnameout.$codeout.$myrow['idnum']."\')', 10000);
                         setTimeout('window.open(\'test.php?results\',\'newid"
    .$fnameout.$lnameout.$codeout.$myrow['idnum']."\')', 37000);
                         setTimeout('window.open(\'test.php?results\',\'newpw"
    .$fnameout.$lnameout.$codeout.$myrow['idnum']."\')', 37000);
                         }</script>"
    ;
                   echo 
    "<a href=\"#!\" onclick=\"func".$fnameout.$lnameout.$codeout.$myrow['idnum']."()\">ADD&nbsp;USER</a></td>";
                   echo 
    "<td class=\"statuscreate\" ><div id=\"iframecreate\"><iframe class=\"iframecreate\" src=\"\" name=\"create".$fnameout.$lnameout.$codeout.$myrow['idnum']."\"></iframe></div></td>";
                   echo 
    "<td class=\"statusid\"><div id=\"iframenewid\"><iframe class=\"iframenewid\" src=\"\" name=\"newid".$fnameout.$lnameout.$jcodeout.$myrow['idnum']."\"></iframe></div></td>";
                   echo 
    "<td class=\"statuspw\"><div id=\"iframenewpw\"><iframe class=\"iframenewpw\" src=\"\" name=\"newpw".$fnameout.$lnameout.$codeout.$myrow['idnum']."\"></iframe></div></td>";
                   echo 
    "<td class=\"blankright\"><div id=\"iframeload\"><iframe class=\"iframeload\" src=\"\" name=\"load".$fnameout.$lnameout.$codeout.$myrow['idnum']."\"></iframe></div></td>";
                   echo 
    "</tr>";
                   
                 }
                   

    ?>     
    </table>
    Last edited by elite-fusion; Jan 16th, 2019 at 10:28 PM.

  2. #2
    Regular Coder
    Join Date
    Sep 2014
    Posts
    299
    Thanks
    1
    Thanked 52 Times in 50 Posts
    Not quite sure what you are trying to do but, as I understand it, you want to load the iframes one at a time. The only thing I can think of is to do the iframe load client side (Javascript). This means you will have to handle the onload event of the iframe. eg. Load IFrame1, onload = Load Iframe 2, onload = load Frame 3. The easiest way to do it is to collect the iframe infos in an array. You then process the entries one at a time. What I mean is, onload of IFrame[1], load FRame[2], ....

  3. #3
    New Coder
    Join Date
    Sep 2009
    Posts
    69
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by josephm View Post
    Not quite sure what you are trying to do but, as I understand it, you want to load the iframes one at a time. The only thing I can think of is to do the iframe load client side (Javascript). This means you will have to handle the onload event of the iframe. eg. Load IFrame1, onload = Load Iframe 2, onload = load Frame 3. The easiest way to do it is to collect the iframe infos in an array. You then process the entries one at a time. What I mean is, onload of IFrame[1], load FRame[2], ....
    What I am trying to do is to have all the iframes to load in order frame1 frame2 frame3 for each Table Row (which is what this does already), but I want it to go through the all Table Rows on ONE click, instead of clicking on each Add User link for each row.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •