Question: I have this form:

```
<form name ='vote' action='' method='POST'>
    while ($row = mysql_fetch_array($result)){
       <input type='checkbox' name='things[]' value='".$row['name_song']."'
              name='send' onClick='anyCheck(this.form)'>
    } 
    <input type='submit' value='test' name='send'></form>

```

What must I do to make it so that the max times (**t**) that people could vote would be an integer? I wish to pass the value to the anyCheck function as, for example, $maxvotes.

```
<script type="text/javascript"> 
   function anyCheck(f, e) {
      e = e || window.event;
      var t = 0;
      var c = f['things[]'];
      for (var i = 0; i < c.length; i++) {
         c[i].checked ? t++ : null;
      }
      if (t == 3) {
         alert("Daugiausiai galite balsuoti už triks kūrinius")
         var targ = event.target || event.srcElement;
         targ.checked = false;
      }
   }
</script>

```

Answer: 
To pass classes by reference use `ref` keyword:

```
private void Insert(ref TreeNode treeNode, ref TreeNode newNode)
{
    newNode = new TreeNode(3);
    treeNode = new TreeNode(4);
}

```

In your original method only **copies** of references to classes are passed, they are not passed by reference. So if you are doing `new` you are just replacing local copies of class references, but calling method still keeps the original reference values. As a result, newly created values are not returned back to the caller.

Change your `Insert(data)` method (without `ref` keyword compiler will give you an error):

```
public void Insert(int data)
{
    TreeNode tempNode = null;
    Insert(ref _root, ref tempNode);
} 

```

This is actually a compiler requirement, just to make sure that the caller is aware that object passed may be replaced by other object after the method call.

You may also want to read about `out` keyword. While `ref` parameters should be initialized before the call, `out` parameters are expected to be initialized inside of the method.
Have a look at the `out`, and `ref` modifiers for parameters. For example, you could 

```
private void Insert(ref TreeNode treeNode, TreeNode newNode)

```