初始化后,我可以将一些数据永久存储在变量中吗?

I have a form which has two input field called firstname and lastname with a submit button called submit. The input fields use twitter's typeahead.js with custom event trigger (typeahead:selected)

Thus, when the firstname is selected from the dropdown, I have a ajax call in the trigger which post the enrollment no of the selected person to another php page(xyz.php).

Here on xyz.php If I store that enrollment number in a variable
$link = POST['number'];

Now this works just fine.

But the problem is when I click my button I have another AJAX call to the same php file. And now I cannot use $link. It says Notice: Undefined index: number

Is there anyway I can get my variable to store the data permanently?

You can use session on the server side to store data across requests. You can find more information here: http://www.php.net/manual/en/intro.session.php

You can use sessions or a text file or a cookie, it depends your needs.