Using a Non-Existant Variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mastertrap24
Forum Newbie
Posts: 2
Joined: Tue Jan 15, 2008 1:43 am

Using a Non-Existant Variable

Post 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?
User avatar
markusn00b
Forum Contributor
Posts: 298
Joined: Sat Oct 20, 2007 2:16 pm
Location: York, England

Re: Using a Non-Existant Variable

Post by markusn00b »

category_list.name isn't a variable.. it's just an option value..

Or atleast, that's how it looks.
mastertrap24
Forum Newbie
Posts: 2
Joined: Tue Jan 15, 2008 1:43 am

Re: Using a Non-Existant Variable

Post 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.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Using a Non-Existant Variable

Post 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.
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply