1
votes

i'm using javascript and php for my pop up window. the plan is to pass the row id on the parent page to the pop up window.

it's working fine with this code:

<a href="#" onclick="PopupCenter('example.php', 'myPop1',500,400); " class="add"><img src='images/buttons/edit.png' title='Edit Content'></a>

the pop up appears. but when i try to add ?textID=<?$row['textID']?>, which is the code i'm using to pass the row id that ends up like this:

<a href="#" onclick="PopupCenter('example.php?textID=<?$row['textID']?>', 'myPop1',500,400); " class="add"><img src='images/buttons/edit.png' title='Edit Content'></a>

the pop up does not work. it appears to be just refreshing the page. thank you for your help.

here's my complete code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?php
    include("global.php");
?>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>About | ILAM</title>

<!-- main css -->
<link href="style.css" rel="stylesheet" type="text/css">
<link href="styleAdmin.css" rel="stylesheet" type="text/css">

<script type= "text/javascript">
    <!-- showHideDiv -->
    function divHideShow(divToHideOrShow){
        var div = document.getElementById(divToHideOrShow);
        if (div.style.display == "block"){
            div.style.display = "none";}
        else{
            div.style.display = "block";}
    }         

    <!-- popUp -->
        function PopupCenter(pageURL, title,w,h) 
            {
                var left = (screen.width/2)-(w/2);
                var top = (screen.height/2)-(h/2);
                var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
            }
</script>
</head>

<!-- Body -->
<body>
<div id="pagewrap">
    <!-- Header -->
    <div id="header">
        <div class="floating-menu">
            <div class="logo"><img src="images/static/ilamLogo.png"></div>
            <div class="translator">
            </div>
            <ul>
                <li><a href="join.php">Join Us!</a></li>
                <li><div class="indent">&nbsp;</div></li>
                <li><a href="contact.php">Contact</a></li>
                <li><a href="career.php">Career</a></li>
                <li><a href="gallery.php">Gallery</a></li>
                <li><a href="facilities.php">Facilities</a></li>
                <li><a href="courses.php">Courses</a></li>
                <li><a href="#" class="active">About</a></li>
                <li><a href="index.php">Home</a></li>
                <li><a href="javascript:divHideShow('menuContentBanner');divHideShow('menuContentBannerText');divHideShow('menuOpenPost');divHideShow('menuMainPost');divHideShow('menuFooterLeft');divHideShow('menuFooterMiddle');divHideShow('menuFooterRight');">Admin</a></li>
            </ul>
        </div>
    </div>
    <!-- //Header -->
    <!-- ContentBanner -->
    <div id="contentBanner"> 
        <div id="menuContentBanner" class="menuBarStyle">
            <div class="addEditDelete">
                <ul>
                <li><a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Image"></a></li>
                </ul>
            </div>
        </div>
    <img src="images/headers/aboutHeader.jpg"></div> <!--BannerImage -->    
    <div class="textLeft">
        <div id="menuContentBannerText" class="menuBarStyle">
            <div class="addEditDelete">
                <ul>
                <li><a href="#" onclick="PopupCenter('edit_article.php', 'myPop1',500,400); "  class="add"><img src="images/buttons/edit.png" title="Edit Content"></a></li>
                </ul>
            </div>
        </div>  
    <h3>As an Academic Institution.</h3><p> ILAM takes to heart its responsibilities, not only to its students, but also to its team, and community</p></div> <!-- BannerText -->
    <!-- //ContentBanner -->
    <!-- Content: Blue -->
    <div id="content">  
        <!-- SidePost -->
        <aside id="sidebar">
            <section class="widget">
                <ul>
                    <li><a href="#"><img src="images/buttons/factsbtn.png" onmouseover="this.src='images/buttons/factsbtnHover.png'" onmouseout="this.src='images/buttons/factsbtn.png'"></a></li>
                    <li><a href="#"><img src="images/buttons/testibtn.png" onmouseover="this.src='images/buttons/testibtnHover.png'" onmouseout="this.src='images/buttons/testibtn.png'"></a></li>
                    <li><a href="#"><img src="images/buttons/promosbtn.png" onmouseover="this.src='images/buttons/promosbtnHover.png'" onmouseout="this.src='images/buttons/promosbtn.png'"></a></li>
                </ul>
            </section>
        </aside>
    <!-- //SidePost -->
    <!-- OpenerPost -->
        <article class="openerPost">
            <table>
                <tr>
                    <div id="menuOpenPost" class="menuBarStyle">
                        <div class="addEditDelete">
                        <ul>
                            <li><a href="#" onclick="PopupCenter('example.php?promoID=<?=$row['promo_id']?>', 'myPop1',400,400); "><img src="images/buttons/edit.png" height="27" width="65"></a></li>
                        </ul>
                        </div>
                    </div>
                </tr>
                <tr>
                    <td><?php
                            $query="SELECT * from text_tb WHERE textID = '1'";
                            $result=mysql_query($query);
                            if (!$result) {
                                echo 'Could not run query: ' . mysql_error();
                                exit;
                            }
                            $row = mysql_fetch_row($result);
                            echo $row[1]; // the email value
                            ?>
                    </td>
                </tr>
            </table>
        </article>
    </div>
    <!-- //OpenerPost -->
    <!-- Content: White -->
    <div id="content">
        <article class="mainPost">
            <table>
                <tr>
                    <div id="menuMainPost" class="menuBarStyle">
                        <div class="addEditDelete">
                        <ul>
                            <li><a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Content"></a></li>
                        </ul>
                        </div>
                    </div>
                </tr>
                <tr><td class="title">Our Mission</td></tr>
                <tr>
                    <td><p>As an academic institution, ILAM takes to heart its responsibilities, not only to its students, 
                    but also to its team, and community. We know that in addition to reaching our vision for the school, ILAM has
                    a role and certain duties that it has to carry out.</p></td>
                </tr>

                <tr>
                    <td class="subtitle">For the Students.</td>
                </tr>
                <tr>
                    <td><p>International Language Academy Manila (I.L.A.M.) is a premier language school in Makati 
                    City, Philippines whose mission is to provide quality education to professionals and 
                    non-professionals aiming to be proficient in English.  The school takes pride in its ESL/EFL
                    courses such as:  Functional Grammar, Conversation, Business Writing, Business English, 
                    Pronunciation, IELTS review, TOEIC review, etc.  which are all taught in a multidisciplinary 
                    setting to ensure comprehensive skill development in the four areas of communication (listening,
                    speaking, reading, and writing). Apart from teaching English, the school also intends to inculcate strong intercultural 
                    awareness among its students by integrating outdoor activities in its curriculum. </p></td>
                </tr>   
                <tr>
                    <td class="subtitle">For the Community.</td>
                </tr>               
                <tr>                
                    <td><p>As an academic institution, ILAM takes heart to its responsibilities in promoting education and tourism in the country, which is the reason behind its partnership with the Bureau of Immigration and various multinational companies for English training. It aims to show its foreign students how much the 
                    country has improved, and that the Philippines is a place where they can always find another
                    home. ILAM goes beyond the technicalities of language. It offers students the opportunity to
                    foster a deeper understanding of various cultures and thus, enables them to appreciate more the 
                    beauty of language as they get to communicate and interact with different people.</p></td>
                </tr>
                <tr>
                    <td class="subtitle">For its Team.</td>
                </tr>
                <tr>
                    <td><p>As an academic institution, ILAM takes heart to its responsibilities in promoting education 
                    and tourism in the country, which is the reason behind its partnership with the Bureau of Immigration and various
                    multinational companies for English training. It aims to show its foreign students how much the 
                    country has improved, and that the Philippines is a place where they can always find another
                    home. ILAM goes beyond the technicalities of language. It offers students the opportunity to
                    foster a deeper understanding of various cultures and thus, enables them to appreciate more the 
                    beauty of language as they get to communicate and interact with different people.</p></td>
                </tr>
            </table>
        </article>
    </div>

    <footer id="footer">
        <table>
            <tr>
                <td>
                    <div id="menuFooterLeft" class="menuBarStyle">
                        <a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Content"></a>
                    </div>
                    <h3>Let's Meet</h3>
                    <p>2/F Makati Creekside Mall Bldg. Amorsolo Cor. VA Rufino St. Legazpi Village, Makati City Philippines</p></td>
                <td>
                    <div id="menuFooterMiddle" class="menuBarStyle">
                        <a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Content"></a>
                    </div>
                    <h3>Let's Talk</h3>
                    <p>Telephone: 632-8400285 / 519 9502<br>Cellphone: 0917-5324332</p></td>
                <td>
                    <div id="menuFooterRight" class="menuBarStyle">
                            <a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Content"></a>
                    </div>
                <h3>The Affiliates</h3>
                <p>Accenture<br>
                Asian Institute of Management<br>
                ConveyThis<br>
                The Little Web Directory<br></td>
            </tr>
            <tr>
                <td class="copyright">Copyright &copy; 2012 ILAM</td>
            </tr>
        </table>
    </footer>
</div>
<!-- /#pagewrap -->

</body>
</html>
3
what is <? $row['textID']?> ... if its PHP, then you need to use <?php echo $row['textID'] ?>jamis0n

3 Answers

1
votes

you need to use echo like:

<?php echo($row['textID']) ?>
1
votes

Looks like it is PHP. To insert the PHP variable into your HTML, use echo, like this:

<a href="#" 
    onclick="PopupCenter('example.php?textID=<?php echo $row['textID'] ?>', 'myPop1',500,400); " class="add">
    <img src='images/buttons/edit.png' title='Edit Content'>
</a>
0
votes

if shorthand is allowed, this should work

<?=$row['textID']?>