Jump to content

Recommended Posts

I have a php generated webpage that reads in data from a MySQL database and displays it. One of the database fields being displayed can be moused over and it creates a link. (this is adapted code so I can't say it ever worked).

In the beginning of the code is this:

 
<SCRIPT LANGUAGE=JavaScript>
function 
smallpopUp(url) {
myWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=1,height=1');
self.name "mainWin"; }
</SCRIPT>



Later in the code, is this (this generates the link based on the mouse-over)

print "</td>
        <td>
        <a href=\"javascript:smallpopUp('sendcmd.php?cmd=
$prefix$row[code]')\">                
        
$row[code]</a>        
        </td>    
        </tr>"
;


What is supposed to happen is that when any displayed entry is clicked, the script sendcmd.php is supposed to be called (this part works) and the value of $cmd passed to it. Of course $cmd is empty at the popup window (sendcmd.php).

What do I need to do in order to make this work?[/code]
 

Well, it could be a number of things.

 

Have you checked the HTML source code to see if there is actually any value following: sendcmd.php?cmd=

 

If no, then the variables $prefix and $row[code] are likely not set. Or, are you trying to use those to reference a variable variable?

 

If yes, then the script sendcmd.php is likely not referencing that value correctly.

 

Based upon your description, I think the problem is the former - the variables are not set when the page is created. Where are $prefix and $row[code] defined?

Well, it could be a number of things.

 

Have you checked the HTML source code to see if there is actually any value following: sendcmd.php?cmd=

 

If no, then the variables $prefix and $row[code] are likely not set. Or, are you trying to use those to reference a variable variable?

 

If yes, then the script sendcmd.php is likely not referencing that value correctly.

 

Based upon your description, I think the problem is the former - the variables are not set when the page is created. Where are $prefix and $row[code] defined?

 

Yes there is and it shows in the URL.

 

$Prefix and $row are the results of reading in MySQL data. I know they exist because they're displayed on the generated page just fine.

 

Here's the complete page source

 

<HTML>

<title>Arcom RC210 Web RCP</title>

<HEAD>

    <link rel="Stylesheet" rev="Stylesheet" href="stylesheet.css" type="text/css" media="Screen">

</HEAD>

 

<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0">

 

<table class="transp" width="100%" height="100%" cellspacing="0" cellpadding="2">

<tr><td height="1%" bgcolor="#D4C69A" class="nav" nowrap>

 

<a href="index.php">Home</a>&nbsp;&nbsp;

<a href="macros.php">Macros</a>&nbsp;&nbsp;

<a href="setpoints.php">Set Points</a>&nbsp;&nbsp;

<a href="ports.php?port=1&tab=1">Port &amp; Global Programming</a>&nbsp;&nbsp;

<a href="codes.php">Command Codes</a>&nbsp;&nbsp;

<a href="dvr.php">DVR</a>&nbsp;&nbsp;

<a href="control.php">CONTROL</a>&nbsp;&nbsp;

<a href="vocab.php">Word List</a>&nbsp;&nbsp;

<a href="mfunctions.php">Macro Functions</a>&nbsp;&nbsp;

<a href="irlp.php">IRLP</a>&nbsp;&nbsp;

<a href="rc2105_5manual.pdf" target="_blank">RC210 5.50 Manual</a>&nbsp;&nbsp;

</td></tr>

<TR><TD height="98%" valign=\"top\">

<SCRIPT LANGUAGE=JavaScript>

 

function smallpopUp(url) {

myWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=1,height=1');

self.name = "mainWin"; }

 

</SCRIPT>

<!--

<script language="JavaScript">

var Result = "";

location.href="sendcmd.php?cmd=" + Result;

</script>

-->

 

 

<BR>

 

 

<H2 align="center" class="primarycolor">Command Codes</H2>

<P align="center">Click the function number on the left to send the command code.<BR>

<!-- Click the link on the right to send the command.</P> -->

<table align="center" border=0 cellspacing=0 cellpadding=0 width="600">

 

 

    <tr >

        <td colspan=4 height="50" valign="bottom"><TABLE BORDER="0" CELLPADDING=0 CELLSPACING=0 WIDTH="400" align="LEFT"><TR>

    <td rowspan="2">&nbsp;</td>

 

        <TD BGCOLOR="D4C69A" ALIGN=LEFT VALIGN=TOP>

            <IMG height="9" src="tab-left.gif" width="9"><BR>

        </TD>

        <TD BGCOLOR="D4C69A" width="11%" ROWSPAN=2 ALIGN="MIDDLE">

            <A class="tablinkselected" HREF="codes.php?tab=alarms">Alarms</A><BR>

        </TD>

        <TD BGCOLOR="D4C69A" ALIGN="RIGHT" VALIGN="TOP">

            <IMG height="9" src="tab-right.gif" width="9"><BR>

        </TD>

        <td rowspan="2">

            &nbsp;

        </td>

    

        <TD BGCOLOR="500000" ALIGN=LEFT VALIGN=TOP>

            <IMG height="9" src="tab-left.gif" width="9"><BR>

        </TD>

        <TD BGCOLOR="500000" width="11%" ROWSPAN=2 ALIGN="MIDDLE">

            <A class="tablink" HREF="codes.php?tab=linking">Linking</A><BR>

        </TD>

        <TD BGCOLOR="500000" ALIGN="RIGHT" VALIGN="TOP">

            <IMG height="9" src="tab-right.gif" width="9"><BR>

        </TD>

        <td rowspan="2">

            &nbsp;

        </td>

    

        <TD BGCOLOR="500000" ALIGN=LEFT VALIGN=TOP>

            <IMG height="9" src="tab-left.gif" width="9"><BR>

        </TD>

        <TD BGCOLOR="500000" width="11%" ROWSPAN=2 ALIGN="MIDDLE">

            <A class="tablink" HREF="codes.php?tab=auxaudio">Aux Audio</A><BR>

        </TD>

        <TD BGCOLOR="500000" ALIGN="RIGHT" VALIGN="TOP">

            <IMG height="9" src="tab-right.gif" width="9"><BR>

        </TD>

        <td rowspan="2">

            &nbsp;

        </td>

    

        <TD BGCOLOR="500000" ALIGN=LEFT VALIGN=TOP>

            <IMG height="9" src="tab-left.gif" width="9"><BR>

        </TD>

        <TD BGCOLOR="500000" width="11%" ROWSPAN=2 ALIGN="MIDDLE">

            <A class="tablink" HREF="codes.php?tab=ufoutputs">Digital outputs</A><BR>

        </TD>

        <TD BGCOLOR="500000" ALIGN="RIGHT" VALIGN="TOP">

            <IMG height="9" src="tab-right.gif" width="9"><BR>

        </TD>

        <td rowspan="2">

            &nbsp;

        </td>

    

        <TD BGCOLOR="500000" ALIGN=LEFT VALIGN=TOP>

            <IMG height="9" src="tab-left.gif" width="9"><BR>

        </TD>

        <TD BGCOLOR="500000" width="11%" ROWSPAN=2 ALIGN="MIDDLE">

            <A class="tablink" HREF="codes.php?tab=Port1">Port 1</A><BR>

        </TD>

        <TD BGCOLOR="500000" ALIGN="RIGHT" VALIGN="TOP">

            <IMG height="9" src="tab-right.gif" width="9"><BR>

        </TD>

        <td rowspan="2">

            &nbsp;

        </td>

    

        <TD BGCOLOR="500000" ALIGN=LEFT VALIGN=TOP>

            <IMG height="9" src="tab-left.gif" width="9"><BR>

        </TD>

        <TD BGCOLOR="500000" width="11%" ROWSPAN=2 ALIGN="MIDDLE">

            <A class="tablink" HREF="codes.php?tab=Port2">Port 2</A><BR>

        </TD>

        <TD BGCOLOR="500000" ALIGN="RIGHT" VALIGN="TOP">

            <IMG height="9" src="tab-right.gif" width="9"><BR>

        </TD>

        <td rowspan="2">

            &nbsp;

        </td>

    

        <TD BGCOLOR="500000" ALIGN=LEFT VALIGN=TOP>

            <IMG height="9" src="tab-left.gif" width="9"><BR>

        </TD>

        <TD BGCOLOR="500000" width="11%" ROWSPAN=2 ALIGN="MIDDLE">

            <A class="tablink" HREF="codes.php?tab=Port3">Port 3</A><BR>

        </TD>

        <TD BGCOLOR="500000" ALIGN="RIGHT" VALIGN="TOP">

            <IMG height="9" src="tab-right.gif" width="9"><BR>

        </TD>

        <td rowspan="2">

            &nbsp;

        </td>

    

        <TD BGCOLOR="500000" ALIGN=LEFT VALIGN=TOP>

            <IMG height="9" src="tab-left.gif" width="9"><BR>

        </TD>

        <TD BGCOLOR="500000" width="11%" ROWSPAN=2 ALIGN="MIDDLE">

            <A class="tablink" HREF="codes.php?tab=Remote Base">Remote Base</A><BR>

        </TD>

        <TD BGCOLOR="500000" ALIGN="RIGHT" VALIGN="TOP">

            <IMG height="9" src="tab-right.gif" width="9"><BR>

        </TD>

        <td rowspan="2">

            &nbsp;

        </td>

    

        <TD BGCOLOR="500000" ALIGN=LEFT VALIGN=TOP>

            <IMG height="9" src="tab-left.gif" width="9"><BR>

        </TD>

        <TD BGCOLOR="500000" width="11%" ROWSPAN=2 ALIGN="MIDDLE">

            <A class="tablink" HREF="codes.php?tab=misc">Misc</A><BR>

        </TD>

        <TD BGCOLOR="500000" ALIGN="RIGHT" VALIGN="TOP">

            <IMG height="9" src="tab-right.gif" width="9"><BR>

        </TD>

        <td rowspan="2">

            &nbsp;

        </td>

    </tr><tr>

        <TD BGCOLOR="D4C69A">&nbsp;</TD>

        <TD BGCOLOR="D4C69A">&nbsp;</TD>

        

        <TD BGCOLOR="500000">&nbsp;</TD>

        <TD BGCOLOR="500000">&nbsp;</TD>

        

        <TD BGCOLOR="500000">&nbsp;</TD>

        <TD BGCOLOR="500000">&nbsp;</TD>

        

        <TD BGCOLOR="500000">&nbsp;</TD>

        <TD BGCOLOR="500000">&nbsp;</TD>

        

        <TD BGCOLOR="500000">&nbsp;</TD>

        <TD BGCOLOR="500000">&nbsp;</TD>

        

        <TD BGCOLOR="500000">&nbsp;</TD>

        <TD BGCOLOR="500000">&nbsp;</TD>

        

        <TD BGCOLOR="500000">&nbsp;</TD>

        <TD BGCOLOR="500000">&nbsp;</TD>

        

        <TD BGCOLOR="500000">&nbsp;</TD>

        <TD BGCOLOR="500000">&nbsp;</TD>

        

        <TD BGCOLOR="500000">&nbsp;</TD>

        <TD BGCOLOR="500000">&nbsp;</TD>

        </tr></table>

 

        </td>

    </tr><tr>

            <td class="lightrow">

                <table align="center" border=0 cellspacing=0 cellpadding=4 width="100%">     

                <TR class="darkrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 1 OFF </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#1910')">                

                        1910</a>

                

                 </td>    

            </tr>    

                <TR class="lightrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 1 ON </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#1911')">                

                        1911</a>

                

                 </td>    

            </tr>    

                <TR class="darkrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 1 Interogate </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#1913')">                

                        1913</a>

                

                 </td>    

            </tr>    

                <TR class="lightrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 2 OFF </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#2910')">                

                        2910</a>

                

                 </td>    

            </tr>    

                <TR class="darkrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 2 ON </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#2911')">                

                        2911</a>

                

                 </td>    

            </tr>    

                <TR class="lightrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 2 Interogate </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#2913')">                

                        2913</a>

                

                 </td>    

            </tr>    

                <TR class="darkrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 3 OFF </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#3910')">                

                        3910</a>

                

                 </td>    

            </tr>    

                <TR class="lightrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 3 ON </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#3911')">                

                        3911</a>

                

                 </td>    

            </tr>    

                <TR class="darkrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 3 Interogate </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#3913')">                

                        3913</a>

                

                 </td>    

            </tr>    

                <TR class="lightrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 4 OFF </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#4910')">                

                        4910</a>

                

                 </td>    

            </tr>    

                <TR class="darkrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 4 ON </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#4911')">                

                        4911</a>

                

                 </td>    

            </tr>    

                <TR class="lightrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 4 Interogate </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#4913')">                

                        4913</a>

                

                 </td>    

            </tr>    

                <TR class="darkrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 5 OFF </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#5910')">                

                        5910</a>

                

                 </td>    

            </tr>    

                <TR class="lightrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 5 ON </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#5911')">                

                        5911</a>

                

                 </td>    

            </tr>    

                <TR class="darkrow">

                    <td> &nbsp;

                    </td>

                    

                    <td>Alarm 5 Interogate </td>

                 <td>

                        <a href="javascript:smallpopUp('sendcmd.php?cmd=#5913')">                

                        5913</a>

                

                 </td>    

            </tr></table></td></tr></table><tr><td height="1%">

 

<table width="100%" class="darkrow" cellpadding="3" cellspacing="0"><tr><td>

Copyright&copy; 2005 - 2013 by Arcom Communications. All Rights Reserved.

</td></tr></table>

 

</td></tr></table>

</body>

</html>

 

Edited by KenHorse
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.