How to create dynamically associative array in PHP?

Hi,

I have an html page like this:

<html>
<body>
<form action="test.php" method = "post">
Enter your name:<input name="search" type = "text" size ="40">
<br>
Enter your age:<input name="age" type = "text" size ="20">
<input type = "submit" name="submit" value="search">
<input type = "submit" name="submit" value="age">
</form>
</body>
</html>

User has to enter names and age.

I need to create key,value pair in PHP.

For example: If user enters multiple names: john,ram,maddy,ganga and there age 21,22,23,24.

then i need to create an associative array in PHP. I am not able to create the associative array in PHP.

The output should be like this:

key and value: 21 and john
key and value: 22 and ram
key and value: 23 and maddy
key and value: 24 and ganga

How can i create associative array dynamically in PHP?

I am begineer in PHP so help is very much appreciated.

Regards

What have you tried so far?

Your post only shows your HTML code. What about your PHP code?