我的功能不是读取我的动态文本框值

Im having a hard time figuring why my function is not inserting my dynamic textbox values while others are working correctly. Ill just show the codes of my dynamic textbox.

Here is my register.php - i think its fine here because i can add and delete textboxes. Then if I will press submit it does my doRegister function.

require_once './library/config.php';
require_once './library/functions.php';

if (isset($_POST['firstname']) && isset($_POST['lastname'])) {
$result = doRegister();
if ($result != '') {
    $errorMessage = $result;
   }
}
?>

here is my functions.php

function doRegister()
{
$fname  = $_POST['firstname'];
$mname  = $_POST['middlename'];
$lname  = $_POST['lastname'];
$email  = $_POST['email'];  
$phone  = $_POST['phone'];
$cphone = $_POST['cphone'];
$dob    = $_POST['dob'];
$gender = $_POST['gender'];

$add    = $_POST['address'];
$city   = $_POST['city'];
$state  = $_POST['state'];
$zip    = (int)$_POST['zipcode'];
$typeres    = $_POST['type_res'];   
$liveyear   = $_POST['live_year'];

$pwd    = $_POST['password'];

$type   = $_POST['acctype'];
$pin    = (int)$_POST['pin'];

$errorMessage = '';


$sql = "SELECT fname FROM tbl_users WHERE fname = '$fname' and lname = '$lname'";
$result = dbQuery($sql);
if (dbNumRows($result) == 1) {
    $errorMessage = 'Username is already exist, please try another name.';
    return $errorMessage;
}


$accno = rand(9999999999, 99999999999);
$accno = strlen($accno) != 10 ? substr($accno, 0, 10) : $accno;


$images = uploadProductImage('pic', SRV_ROOT . 'images/thumbnails/');
$thumbnail = $images['thumbnail'];
$insert_id = 0; 
$sql = "INSERT INTO tbl_users (fname, lname, pwd, email, phone, gender, is_active, utype, pics, bdate, mname, cpnum, years_in_city, civil_stat, religion, educ_attain, emp_stat, voter, mother_name, mother_maiden, mother_occu, father_name, father_maiden, father_occu, no_sibling, fam_income, type_res)
        VALUES ('$fname', '$lname', PASSWORD('$pwd'), '$email', '$phone', '$gender', 'FALSE', 'USER', '$thumbnail', NOW(), '$mname', '$cphone', '$liveyear', '$cstat', '$religion', '$high_edu', '$emp_stat', '$voter', '$moname', '$momaid', '$mooccu', '$faname', '$famaid', '$faoccu', '$nosib', '$aveincome', '$typeres')"; 
dbQuery($sql);
$insert_id = dbInsertId();

Now this is my codes for inserting dynamic textbox values.

$itemcount = count($_POST["item_name"]);
$itemvalues = 0;

$query = "INSERT INTO item (item_name,item_price) VALUES ";
$queryValue = "";
for($i=0;$i<$itemCount;$i++) {
  if(!empty($_POST["item_name"][$i]) || !empty($_POST["item_price"][$i])) {
     $itemValues++;
 if($queryValue!="") $queryValue .= ",";
 $queryValue .= "('" . $_POST["item_name"][$i] . "', '" .      $_POST["item_price"][$i] . "')";
  }
  }
  $sql = $query.$queryValue;
  if($itemValues!=0) {
  dbQuery($sql);
  }

  header('Location: aregister.php');
  exit;

  }

Any help comment advice would be greatly appreciated! thank you very very much stackoverflow community!