how i can get array value from txtbox inside while loop in php?

Hello everyone im creating a simple grading post.
My problem is how to get the array from multiple input type=text to update a tbl from mysql

here is my code:
[php]while($row=mysql_fetch_assoc($sql)){
$id=$row[‘id’];
$name=$row[‘studname’];
$cor=$row[‘course’];
$yl=$row[‘YearLevel’];

	echo"<tr bgcolor='#E6E6E6'>
	<td align='left'><p align='left'>".$b.".".$name."</p><input type='text' name='cont[$a]' value=".$id."></td>
	<td><p align='left'>".$cor."</p></td>
	
	<td> <input type='text' name='pre[]' value=''style='width:40px;'></td>
	<td> <input type='text' name='mid[]' value=''style='width:40px;' ></td>
	<td> <input type='text' name='semi[]' value=''style='width:40px;' ></td>
	<td> <input type='text' name='fin[]' value=''style='width:40px;' ></td>
	
	
	
	</tr>";	
	$a++;
	$b++;
	$pre[]=$_POST['pre'];
		}
	
	  echo  "	<tr> <td>
	<input type='submit' name='update[$a]' value='Update'/>
 </td></tr>";

[/php]

if user click the submit button
it well update the tble with same id

[php]if (isset($_POST[‘update’])){

			foreach($_POST['pre'] as $key =>$val){
					
				echo  $val.'-'.$key.' <br/>';
				 
			
			}
	 
			 
	
	 
			 
	
			
	 
		
	}[/php]

How do I build a script and/or function that would get the value from input field in php?
sorry for my bad language im a beginner

Sponsor our Newsletter | Privacy Policy | Terms of Service