I'm working on a way to add recipients from a contact list to an array so that that the contacts of the array can be used as recipients in message. I understand arrays well enough for basic use but have a vexing issue. My list of contacts are dynamically generated in a list with this;
{
$contact = $row['contact'];
echo "<tr>";
echo "<td><font color=#808080><a href='mypagepost.php?contact=$contact' STYLE='TEXT- DECORATION: NONE'><font color=#808080>" . $row['contact'] . "</a></font></td>";
echo "</tr>";
}
So, each contact is variable $contact. When you click on the contact, it takes you to mypagepost.php where this happens;
$messagerecipient = array();
$contact = $_GET['contact'];
$messagerecipient[] = "$contact";
I can print out the contents of the array, no problem. However, every time I add a new contact, it overwrite the contact in [0]. If I manually add new contacts with subsequest $messagerecipient entries, like;
$messagerecipient[] = "Confused";
$messagerecipient[] = "Oh, man";
it increments them just fine; Array ( [0] => csmith [1] => Confused [2] => Oh, man )
But [0] will always be overwritten when I select a new contact. I thought that maybe I needed to make the array into a session, but it does the same thing. Can someone recommend a way to do this? I need each contact added to the array to increment (and, ultimately, I'm going to be setting something up that will allow me to remove entries from the array). Any help is appreciated.