Question: I'm using [JQuery Form Plugin](http://malsup.com/jquery/form/) for AJAX file uploader.

The (html) form is **created dynamically**, and looks like this:

```
<form id="formUpload" action="fileReceiver.php" method="post" enctype="multipart/form-data">
    <input type="file" name="fileUpload" multiple>
    <input type="submit" value="Upload File to Server">
</form>

```

Because, the form is created dynamically, I'm using jquery on(). I also **need to send a few variables**, I'm using [data options](http://malsup.com/jquery/form/#options-object) from the plugin.

The Javascript looks like this:

```
$(document).on("submit", "form#formUpload", function() {
    $(this).ajaxForm({
        data: { someVariable : 'someValue' },
        complete: function(xhr) {
            status.html(xhr.responseText);
        }
    }); 
});

```

I think the form is binded correctly, I could call/alert something from the ajaxForm (jquery form plugin) function through beforeSend or Success options.

Now, the problem is the PHP couldn't get the data I posted in the Javascript.

My PHP is simple like this:

```
<?php
   echo $_POST["someVariable"];
?>

```

It gives me error "**Notice: Undefined index**: someVariable blah blah blah"

Any advice? Thx :)

Answer: 
The proper way to create an instance of a type is to call the constructor on the type and assign the result to a variable of that type:

```
var
  Param: CustomParam;

Param := CustomParam.Create;

```

Instances created that way are already references, so there's rarely a need for an additional pointer.

If you really must have a pointer, then start by declaring the type:

```
type
  PCustomParam = ^CustomParam;

```

Then declare a variable:

```
var
  Param: PCustomParam;

```

Allocate memory for the contents of the thing it points to:

```
New(Param);

```

That doesn't necessarily assign a valid value to the CustomParam reference it points to, but if it does, is assigns the value nil. So finally, assign a value to that newly allocated memory:

```
Param^ := CustomParam.Create;

```

Notice how we still have to call the constructor, and we never call the constructor on the object we're creating, because that object doesn't exist until after the constructor is called.
Your problem is that your declaration

pCustomParam = CustomParam

defines pCustomParam to be of type CustomParam, not a POINTER to Customparam.

Hence `pointerToCustomParam` will not be a POINTER, but a CustomParam - hence the 'rubbish contents'

Try

pCustomParam = ^CustomParam;