$WA_fieldValuesStr = ""
.((isset($_POST["agent_id"]))?$_POST["agent_id"]:"")
."";
If I understand your question, it is how to insert an array of id numbers into a single field.
Someone has explained how to return an array from your HTML form, now you need to
a) check that even one exists
b) turn that array into a string, and lets say that is a csv string.
$agent_string = implode( ',' , $_POST['agent_id'] ) ;
then insert $agent_string into your database. I think that is answering the question you asked.
However, doing that is going possibly cause you problems further down the line, and really most common wisdom suggests that you ought to be looking to create a table which contains these relationships - all part of database normalization, which you can look up.
Here is a really simple example of what I mean, imagining your “agents” are sales agents dealing with “companies” :
table: contacts (contact_id, contact_name)
===========
1 - "big company"
2 - "small company"
table: agents (agent_id, agent_name )
=========
1 - "Bob"
2 - "Ted"
//referential table
table contact_agent (contact_ref, agent_ref)
============
1 - 1
1 - 2
2 - 1
With a suitable sql statement you can use joins to discover that in the above contrived example Bob is the agent for both companies, while Ted is the contact for just “small company”
This allows you to easily ask the questions:
Which companies is Bob the agent for?
Which companies is Bob not the agent for?
Which companies have no agent?
Which companies have got 2 agents?
Which agent has the biggest/smallest workload?
What is the average client number our agents currently have?
Who are the agents for “big company”?
These types of queries, when joined to other tables can reveal a lot of management account information - one can imagine that joined with sales data you could find out which companies spend the most but have the least agents, and so on - none of which will be very easy or even doable without multiple complex selects do unpick the imploded array you seem to be asking to store in your database.
Using a system as outlined might be more appropriate for you, but you know your own data better than us.