从隐藏的输入中获取价值

I have these hiiden fields for each product. I can get the hidden fiels with jquery. But when I enter data it doesnt go to database, I shows always 0. I thinit is because of the same named values. how can I solve this problem without changing the input names!

I have also one table on my database for all products.

<select id="mySelect" onchange="npup.doSelect(this);" name="catagory" type="text">
        <option value="">choice</option> 
        <option value="curtain_fabrics">Curtain Fabrics</option>
        <option value="curtain">Curtains</option>
        <option value="curtain_holder">Curtain Holders</option>
    </select>
    <div id="mySpecialElements">
          <div id="npupcurtain_fabrics" class="hidden">
           <div class="fe" >Quality: <input type="text" name="quality">  </div>
           <div class="fe" >Width:<input type="text" name="width"> </div>
           <div class="fe" >Price:<input type="text" name="price"> $/m</div>
        </div>

       <div id="npupcurtain" class="hidden">
           <div class="fe" >Quality<input type="text" name="quality"></div>
           <div class="fe" >Width:<input type="text" name="width"> </div>
           <div class="fe" >Height:<input type="text" name="height"></div>
           <div class="fe" >Price:<input type="text"  name="price" >$/set</div>
       </div>

       <div id="npupcurtain_holder" class="hidden">
           <div class="fe" >Material<input type="text" name="material"></div>
           <div class="fe" >Moldel:<input type="text" name="model"> </div>
           <div class="fe" >Price:<input type="text"  name="price" >$/piece</div>
        </div>

Here is mysql code:

  $sql = mysql_query("INSERT INTO products (name, catagory, quality, width,  height,  price, date_add)
VALUES('$product_name','$product_category','$prosuct_quality','$produt_width','$product_height','$product_price', now())");

use id tag vs name tag in your html

Example change

<div class="fe" >Quality: <input type="text" name="quality"> </div>

to

<div class="fe" >Quality: <input type="text" id="quality"> </div>

You can send them to the server as arrays:

 <div id="npupcurtain_fabrics" class="hidden">
           <div class="fe" >Quality: <input type="text" name="fabrics[quality]">  </div>
           <div class="fe" >Width:<input type="text" name="fabrics[width]"> </div>
           <div class="fe" >Price:<input type="text" name="fabrics[price]"> $/m</div>
        </div>

       <div id="npupcurtain" class="hidden">
           <div class="fe" >Quality<input type="text" name="npupcurtain[quality]"></div>
           <div class="fe" >Width:<input type="text" name="npupcurtain[width]"> </div>
           <div class="fe" >Height:<input type="text" name="npupcurtain[height]"></div>
           <div class="fe" >Price:<input type="text"  name="npupcurtain[price]" >$/set</div>
       </div>

       <div id="npupcurtain_holder" class="hidden">
           <div class="fe" >Material<input type="text" name="holder[material]"></div>
           <div class="fe" >Moldel:<input type="text" name="holder[model]"> </div>
           <div class="fe" >Price:<input type="text"  name="holder[price]" >$/piece</div>
        </div>

In the server-side..say PHP the variables would be like:

$_POST['fabrics']['quality'];
$_POST['holder']['model'];
....

After seeing the comments, I think the problem is with your SQL only, not the other parts. You might not do the concatenation and building query correctly. Try the following code. (I need to mention that it is not recommended to concatenate the string like this. Use placeholder ? to prevent SQL injection).

    $sql = mysql_query(
    "INSERT INTO products (
                      name, 
                      catagory, 
                      quality, 
                      width,  
                      height,  
                      price, 
                      date_add)
    VALUES(
          '".$product_name."'
        ,'".$product_category."'
        ,'".$prosuct_quality."'
        ,'".$produt_width."'
        ,'".$product_height."'
        ,'".$product_price."'
        , now())");

For placeholders(prepared statements), see http://www.php.net/pdo.prepared-statements

This can be as a result of a wrong data type for the column of the table in the database. E.g. you are inserting a string into a column in the database table that accepts only integers, hence you get the value 0 stored.