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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2006
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts

    handling onclick window.open

    hi,

    i have a mysql table called footers.it's fields are as follows
    id--caption--content
    1--aboutus--some company info
    2--privacy--privacy info
    3--copyright--copyright info

    here i retrieved all the captions from table and print in the footer position on my form as footer menu.what i want to do actually is when i click aboutus,it should open small window and display the aboutus content from mysql table,similarly when i click privacy,it should open a small window and should display privacy info like that.everything i did,but when i click aboutus,it shows all the three records from table.i want to display uniquely.means if i click aboutus it should display only aboutus info in small window like that..any of your help will be greatly appreciated

    here is my code
    <?php
    $conn4=mysql_connect("localhost","","");
    mysql_select_db("jrm",$conn4);
    $sql="SELECT * FROM footers";
    $result=mysql_query($sql,$conn4) or die (mysql_error());
    echo "<center><table border='0' style='text-align:left;'><tr>";
    while($newarray=mysql_fetch_array($result))
    {
    $caption=$newarray['caption'];


    echo "<center><a style='text-decoration:underline;'
    href onclick=window.open('xyz.php','','top=200,left=350,screenY=0,screenX=0,width=400,height=300,scrollba rs=yes');>
    <td><font color='white'><b>".$caption. "&nbsp;&nbsp;</b></font></td></a></center>";
    }
    echo "</tr></table></center>";
    ?>


    xyz.php
    ------
    <?php


    $conn4=mysql_connect("localhost","","");
    mysql_select_db("jrm",$conn4);
    $sql="SELECT * FROM footers";
    $result=mysql_query($sql,$conn4) or die (mysql_error());
    while($newarray=mysql_fetch_array($result))
    {
    $caption=$newarray['caption'];
    $content=$newarray['content'];

    echo "<center><b><u><font color='navy'>".$caption."</font></b></u><br><font color='green'>".$content."</font></center>";
    }

    ?>

    is it possible without using xyz.php file,i will display the $content in small window directly

    thanks
    mrjameer

  • #2
    New Coder
    Join Date
    Jul 2005
    Posts
    81
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try this

    Code:
    <?php
    $conn4=mysql_connect("localhost","","");
    mysql_select_db("jrm",$conn4);
    $sql="SELECT * FROM footers";
    $result=mysql_query($sql,$conn4) or die (mysql_error());
    echo "<center><table border='0' style='text-align:left;'><tr>";
    while($newarray=mysql_fetch_array($result))
    {
    $caption=$newarray['caption'];
    
    
    echo "<center><a style='text-decoration:underline;'
    href onclick=window.open('xyz.php?id=".$newarray['id']."','','top=200,left=350,screenY=0,screenX=0,width=400,height=300,scrollba rs=yes');>
    <td><font color='white'><b>".$caption. "&nbsp;&nbsp;</b></font></td></a></center>";
    }
    echo "</tr></table></center>";
    ?>
    xyz.php

    Code:
    <?php
    
    
    $conn4=mysql_connect("localhost","","");
    mysql_select_db("jrm",$conn4);
    $sql="SELECT * FROM footers where id = '".$_GET['id']."' limit 1";
    $result=mysql_query($sql,$conn4) or die (mysql_error());
    while($newarray=mysql_fetch_array($result))
    {
    $caption=$newarray['caption'];
    $content=$newarray['content'];
    
    echo "<center><b><u><font color='navy'>".$caption."</font></b></u><br><font color='green'>".$content."</font></center>";
    }
    
    ?>
    Yes it is possible to make it without xyz.php file. You could use instead some well formed div. Good Luck
    If you can not find a decision, maybe you have to try to change a problem

    http://www.gunman.co.nr
    http://bglinux.org


  •  

    Posting Permissions

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