SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    trying to use iFrame in php

    I am a beginner looking for some help using an iframe within some php code:

    The following code calls an image and a link from a MySQL databse:

    PHP Code:
    <a href="<?php echo $SchoolsLink ?>"><img src="/images/<?php echo $School -> SchoolsImage ?>" alt="<?php echo $Title ?>" /></a>
    What I want to happen is: When the visitor clicks on the link generated by <?php echo $SchoolsLink ?> I want the next page to open in an iframe... Can anyone help me figure this out?

    Thanks

  2. #2
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    just add target="iFrameName" to the anchor
    Ryan B | My Blog | Twitter

  3. #3
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for replying... What do you mean by "iFrameName"? I was hoping to just use the html <iframe> tags... is there a different way I should do it?

  4. #4
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Most html tags have the name attribute. Give your iframe one, replce my iFrameName with the name you choose.
    Ryan B | My Blog | Twitter

  5. #5
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, I understand that part, but I still have a question (stupid one I am sure):

    I am not sure where to open and close the iframe in that code? I see now that I need to name the iframe, and then put that name in the link target, but where do I open and close the frame around the php?

  6. #6
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    You put it where ever you want it so show up on the page...
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  7. #7
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but I only want it to show up when someone clicks the link.... I want it to replace all the content currently showing when they click it....

  8. #8
    SitePoint Member
    Join Date
    Mar 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    use iframe using javascript

    i want to use iframe within javascript or using javascript.

    my code is like ---
    <script type="text/javascript">
    var Tree = new Array;
    Tree[0] = "1|0|Mobile|#";
    Tree[1] = "2|1| <?php echo $array[0];?> | iphone.php ";
    Tree[2] = "3|1|<?php echo $array[1];?>| blackberry.php";
    Tree[3] = "";
    Tree[4] = "5|1|<?php echo $array[2];?>| android.php";
    Tree[5] = "";
    Tree[6] = "";
    Tree[7] = "";
    Tree[8] = "9|1|<?php echo $array[3];?>| " ;
    </script>
    i want when some one click on iphone.php or blackberry.php ,it will open on the same page in a iframe...
    pls help me....i am a beginer...


Tags for this Thread

Bookmarks

Posting Permissions

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