php - how do i take inputs from various textboxes and store it in an array? -


i have array of textboxes , submit button. want take values of textboxes , store in array , display it. there's kind of syntax error. pls help

<form name="f1" method="post"> <?php include("dbconnect.php"); $res=mysql_query("select * gdc"); $n=mysql_num_rows($res); echo $n; $res2=mysql_query("select * service"); $n2=mysql_num_rows($res); echo $n2;  echo "<table>";    for($i=0;$i<$n2;$i++)    {       echo "<tr>";       for($j=0;$j<$n;$j++)       {          echo "<td><input type='text' name='fte".$i.$j."'/></td>";       }       echo "</tr>";    } echo "</table>"; ?>  <p><input type="submit" name="btn" value="ok"/></p>  <?php if(isset($_post['btn'])) {    for($m=0;$m<$n2;$m++)    {       for($k=0;$k<$n;$k++)    {    echo $_post['fte'.$m.$k];    $cars=array([$_post['fte'.$m.$k]); }  for($s=0;$s<$n2;$s++) {    for($t=0;$t<$n;$t++)    {       echo $cars[$s][$t];    } }  ?> </form> 

the final working code should .

<?php if(isset($_post['btn'])) {     for($m=0;$m<$n2;$m++)     {         for($k=0;$k<$n;$k++)         {             echo $_post['fte'.$m.$k];             $cars[$m][$k]=$_post['fte'.$m.$k];         }     }      for($s=0;$s<$n2;$s++)     {         for($t=0;$t<$n;$t++)         {             echo $cars[$s][$t];         }     } } ?> 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -