Page 1 of 1

Using a Non-Existant Variable

Posted: Tue Jan 15, 2008 1:54 am
by mastertrap24
Hello everybody,
My task is to make some changes to a certain webpage and they gave me access to their site ftp. I downloaded the necessary files and looking at the code:

Code: Select all

 
<script language="javascript">
    function GoToNextCost(el) {
        var idx = el.selectedIndex;
        var term = el.options[idx].value;
        location.href='index.php?term='+term;
    }
</script>
 
 
<FORM METHOD="POST" NAME="form1">
 
<table border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td><img src="../html/images/uni02_title01.gif"></td>
    </tr>
    <tr>
        <td height="30"></td>
    </tr>
    <tr>
        <td height="45">
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <tr>
            <td><img src="../html/images/uni02_subtitle01.gif"></td>
            <td align="right">
                <select name="term" onChange="GoToNextCost(this)">
                    <OPTION VALUE="">Choose</OPTION>
                    <!-- LOOP START 'category_list' -->
                    <OPTION VALUE="{{category_list.name}}">{{category_list.name}}</OPTION>
                    <!-- LOOP END 'category_list' -->
                </select>               
            </td>
            </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td height="1" bgcolor="DCDCDC"></td>
    </tr>
    <tr>
        <td height="15"></td>
    </tr>
    </table>
    </FORM>
Basically, I researched a little (I am new to web programming) and found out that this is a dynamic drop down list. All the tutorials showed explicit data that would go into the drop down list. However, in the code above, the variable category_list is nowhere to be found in that file. What is going on? How is it accessing the data?

Re: Using a Non-Existant Variable

Posted: Tue Jan 15, 2008 2:10 am
by markusn00b
category_list.name isn't a variable.. it's just an option value..

Or atleast, that's how it looks.

Re: Using a Non-Existant Variable

Posted: Tue Jan 15, 2008 2:13 am
by mastertrap24
markusn00b wrote:category_list.name isn't a variable.. it's just an option value..

Or atleast, that's how it looks.

Then shouldn't the drop down menu say "category_list.name"? But if you go to the site,
the drop down menu actually has around 5~6 values. I am guessing it is getting the values from the database but I cannot even find a resembling code of accessing a DB.

Re: Using a Non-Existant Variable

Posted: Tue Jan 15, 2008 2:56 am
by VladSun
Looks like some kind of template system - you need to find where this "view" is loaded from. Then you will find the variable.