phutisemenya 0 Newbie Poster

hi, All
i have two options form; one hold $selection that select suburb from datadase and other $suburb which “Selected Records”.
when a suburb is double clicked, it should automatically be added to the corresponding selected section; and be removed from the selection list. The same with a record that is in “Selected Records”, when double clicked, it should be removed from the “Selected Records” section, back to the “Selection List”. and i managed to do that by javascript but i can't select/save "selected records" from database. please help

notice.php

<script type="javascript">
function RightButton_OnClick()
			{
				var AvailableLB = document.getElementById("selection");
				var LinkedLB = document.getElementById("suburb");
				for (var i=0; i < AvailableLB.length; i++) 
				{
					if (AvailableLB.options[i].selected == true) 
					{
						LinkedLB.options[LinkedLB.length] = new Option(AvailableLB.options[i].text,AvailableLB.options[i].value);
						AvailableLB.options[i] = null;
						i=i-1;
					}
				}
			return;
			}
			function LeftButton_OnClick(LinkedLB)
			{
				var AvailableLB = document.getElementById("selection");
				var LinkedLB = document.getElementById("suburb");
				for (var i=0; i < LinkedLB.length; i++)
				{
					if (LinkedLB.options[i].selected == true)
					{
						AvailableLB.options[AvailableLB.length] = new Option(LinkedLB.options[i].text,LinkedLB.options[i].value);
						LinkedLB.options[i] = null;
						i=i-1;
					}
				}
				return;
			}
</script>
<?php
				include("dbconnect.php");
				$query ="select distinct suburb from customers  order by suburb ";
 				$result = mysql_query($query) or die (mysql_error());
				?>
				<!-- send notifyme notice -->
				<form action="process_notice.php" method="post" >
					<table style="margin:15px">
					<tr>
						<td>
							<p style="margin:0;">Select suburb</p>
						<select name="selection[]" id="selection" multiple size="8" ondblclick="RightButton_OnClick();" style="width:160px"> 
							<?php
							
							while ($row = mysql_fetch_array($result))
 							{
 								echo "<option>".ucwords($row[0])."</option>";
								
 							}
							
							?>
						</select>
						</td>
						<td>
							<input name="moveRight" type="button" value=">>" onClick="RightButton_OnClick();"><br />
							<input name="moveLeft" type="button" value="<<" onClick="LeftButton_OnClick();">
						</td>
						<td>
							<p style="margin:0;">Selected Records</p>
							
							<select name="suburb[]" id="suburb" size="8" multiple ondblclick="LeftButton_OnClick();" style="width:160px">
								
							</select>
							
						</td>
					</tr>
				</table>

process_notice.php
if ($_POST['notice'] !='' || isset($notice))
					{
						
						if ($_POST['suburb']!="Please select a suburb" && $_POST['suburb']!='')
						{
							$suburb= $_POST[suburb];
							for($i=0; $i<$suburb; $i++)
							{
								// send notification
								include("dbconnect.php");
								$notice=$_POST['notice'];
								// To retrieve array 
								$query ="select cell,count(cell) as numcell from customers where suburb='$suburb[$i]' group by suburb";
 								$result = mysql_query($query) or die (mysql_error());
								if(mysql_num_rows($result))
								{
									while ($row = mysql_fetch_array($result))
									{
										echo "<input name=\"suburb\" type=\"hidden\" value=\"<?php echo $row[suburb];?>\">";
										echo "<p> You have sent <span id=\"sentnumber\">".$row[numcell]."</span> people a notification to this suburb: $suburb[$i]</p>";
										echo "<p> Notice: $notice </p>";
									}
								} else {
								echo "<p id=\"error_msg\" >Error: no suburb in database</p>";
								}
							
							exit;
							}
							
							
						} else {
							echo "<p id=\"error_msg\" >Please select a suburb</p>";
							exit;
						}
				
					} else {
					echo "<p id=\"error_msg\" >Please type in your notice</p>";
					exit;
				}