pabirds Posted January 22, 2018 Share Posted January 22, 2018 I am trying to adapt some code I found online and I don't understand one (actually more) of the lines of code. The code is from a function to generate dropdown lists that depend on previous dropdown lists. The line says "echo "addOption(document.drop_list.Category, '$nt1[cat_id]', '$nt1[category]');";" What does the $nt1 mean and why are there two different values for it? Can someone explain this to me in novice language? I can't find any reference to addOption in the Javascript reference. I'm trying to substitute my table fields into the code, but can't figure out which goes where. Link to comment Share on other sites More sharing options...
niche Posted January 22, 2018 Share Posted January 22, 2018 (edited) $nt1 is an array https://www.w3schools.com/js/js_arrays.asp EDIT: the info between the commas are arguments addOption is a function (jquery i think) Edited January 22, 2018 by niche Link to comment Share on other sites More sharing options...
Ingolme Posted January 22, 2018 Share Posted January 22, 2018 $nt1 is a PHP associative array, not a Javascript array. Read about it here: https://www.w3schools.com/php/php_arrays.asp The code you've displayed is a line of PHP that's generating a line of Javascript, you need to be able to distinguish which parts are PHP and quich are Javascript. The addOption function is probably declared elsewhere in the code. Link to comment Share on other sites More sharing options...
niche Posted January 22, 2018 Share Posted January 22, 2018 $ was the givaway sorry about that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now