0

Sir I have these codes

<body onload="code.focus()">

<!------------------------------------->
   <form name="form" action="<?php $_PHP_SELF;?>" method="post">   
<!-------------------------------------> 

  <div id="partybox">

<!--f_date1-->
        <label for="datepicker-13"> Date </label>
        <span style="border:1px solid #FFF;border-radius:3px;width:95px;height:20px;">
        <input   style="background-color:#FFC;border:1px solid #9C6;text-align:center;" type="text"
        size="9" name="f_date1" required
       id="datepicker-13" onblur="validatedate(document.form1.f_date1)"
        value="<?php echo date('d-m-Y', strtotime($f_date1));?>" disabled="disabled"/>
        </span>

 <!--vno-->         
        <label for="vno"> V. # </label>
        <span style="border:1px solid #FFF;border-radius:3px;width:95px;height:20px;">
        <input  style="background-color:#FFC;border:1px solid #9C6;text-align:center;" type="text"
         id="vno" name="vno" required value="<?php echo $myvno;?>"  disabled="disabled" size="6"/>
        </span>

           <label for="acode"> Party </label>&nbsp
           <input style="background-color:#FFC;border:1px solid #9C6;text-align:center;"
       type="text"  maxlength="7"  name="acode" id="acode" onkeyup="amyCall()" 
            value="<?php echo $acc_code1;?>" size="10" readonly/>

             <input style="background-color:#FFC;border:1px solid #9C6;text-align:left;" type="text"
        size="30" maxlength="30" name="aparty" id="aparty"  onkeyup=
"this.value=this.value.toUpperCase()"  value="<?php echo $partyname;?>" readonly/>
 <br />

 </div> <!-- partybox --> 

  <div id="content_area">

<!------------------------------------->
<!-- <H3>Products</H3>-->
<!------------------------------------->
<div class="form" id="products">

<table id="table_pro" width='100%' align='center' cellspacing='-1' cellpadding='2'>
   <thead align="center">
    <tr>
      <th width="5%">S. #</th>
      <th width="15%">Code</th>
      <th width="30%">Products</th>
       <th width="8%">Qty</th>
       <th>pWeight</th>
       <th width="10%">Weight</th>
        <th width="10%">Rate</th>
       <th width="15%">Amount</th>
      <th width="5%">Action</th>
    </tr>
  </thead>
  <tbody id="content_pro"></tbody>
   <tbody>
    <tr class="row_pro">

      <!--sno-->
      <td>
        <input style="text-align:center;color:#F00;" type="number" id="serial"  disabled="disabled" />
        <input type="hidden"  name="indicator"  id="indicator" />
      </td>

     <!--Party code-->
        <td>
 <input style="text-align:center;" type="number" class="code" id="code" name="code[]"  maxlength="7" autocomplete="off"  oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" min="3101001" max="3110999" />
      </td>

      <!--Party Name-->
      <td>
        <input style="text-align:left;" type="text"  class="party" id="party" name="party[]" maxlength="30"  onkeyup="myCall2()" "this.value=this.value.toUpperCase()" />
      </td>

       <!--qty-->
      <td>
        <input style="text-align:right;color:brown;" type="number" class="qty" id="qty" name="qty[]" maxlength="5"  autocomplete="off"  oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"/>
      </td>

             <!--pweight-->
 <td>
        <input style="text-align:right;color:brown;" type="number" class="pweight" id="pweight" name="pweight[]"  maxlength="5" disabled="disabled"  oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" />
         </td>

             <!--weight-->
      <td>
        <input style="text-align:right;color:brown;" type="number" class="weight" id="weight" name="weight[]" maxlength="5" disabled="disabled"/>
      </td>

      <!--rate-->
      <td>
        <input style="text-align:right;color:blue;" type="number" class="rate" id="rate" name="rate[]"  maxlength="4"  autocomplete="off"  oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);"/>
      </td>

            <!--credit-->
      <td>
        <input style="text-align:right;color:blue;" type="number"  class="cr_amount" id="cr_amount" name="cr_amount[]"  maxlength="6"   disabled="disabled"/>
      </td>

      <!--Action-->
      <td>
        <input  type="button" name="addnew" id="addnew_pro" value="Add" size="30" class="button"/>
      </td>
    </tr>

  </tbody>
<!--  <tfoot>-->
    <tr>

      <td></td> 
      <td></td>
   <td align='center'>Total Bill</td>
      <td><input class="rowtot" type="number" name="total_qty" id="total_qty" disabled="disabled"/></td>
      <td></td>
            <td><input class="rowtot" type="number" name="total_weight" id="total_weight"  disabled="disabled"/></td>
      <td></td>             
      <td><input class="rowtot" type="number" name="total_pro" id="total_pro"  disabled="disabled"/></td>
      <td></td>
    </tr>
 <!-- </tfoot>-->
</table>
</div>

<!----------------------------------------------->
<div class="button_bar">
<input type="submit" name="save" id="save" value="Save"  size="30" class="button" />
<input type="submit" name="cancel" id="cancel" value="Cancel"  size="30" class="button" />
</div>

</div> <!-- content_area --> 
<!------------------------------------->
    </form>
<!------------------------------------->

When I run this command

if(isset($_POST["save"])){
echo "<pre>";
print_r($_POST);
echo "</pre>";
exit();

then it says:

Array
(
    [acode] => 2310001
    [aparty] => CASH IN HAND                                                
    [indicator] => 
    [code] => Array
        (
            [0] => 
        )

    [party] => Array
        (
            [0] => 
        )

    [qty] => Array
        (
            [0] => 
        )

    [rate] => Array
        (
            [0] => 
        )

    [save] => Save
)

Why following the data from following inputs is not posting

name="pweight[]"
name="weight[]"
name="cr_amount[]"

Please help

4
Contributors
3
Replies
28
Views
2 Months
Discussion Span
Last Post by AndrisP
1

With the disabled attribute those inputs are not submitted by the browser, you can use readonly instead.

0

What Cereal said, when you have a field that is disabled, it will not send a variable to the server whereas the readonly field will send that field to the server.

0

In line 4 form action change to

<form name="form" action="<?php echo filter_input(INPUT_SERVER, 'PHP_SELF'); ?>" method="post">   
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.