How to prevent values in display none in a table row from being sent via post

Hello,
I have a table like below.
I show #block or #villa rows with the Select option.
Example: How to prevent the input in the #block line from being posted when I submit when the #villa line is shown?

<form>
<table>
<tr>
<td><input type="text" name="baslik"></td>
</tr>

<tbody id="blok" style="display:none;">
<tr>
<td><input type="text" name="birsey"></td>
</tr>
</tbody>

<tbody id="villa" style="display:none;">
<tr>
<td><input type="text" name="birsey"></td>
</tr>
</tbody>

<tr>
<td><input type="text" name="icerik"></td>
</tr>

<input type="submit" value="Gönder" name="B1">
</table>
</form>

You would add the disabled attribute to the input fields. When you make the row visible, you would remove the disabled attribute from the corresponding input.

If you are only making one of the two fields visible, you should simply put both of them in the same <td></td> and put the id=‘blok’ or id=‘villa’ in the input fields.

I disabled all inputs in the fields with display:none by adding the following code to the jquery code I used for the select option.

It is an example, not the full code.

if(select=='villa'){
    $('#villa input').prop('disabled', false);
    $("#villa").show();
    $('#blok input').prop('disabled', true);
    $("#blok").hide();
}else if(select=='blok'){
    $('#blok input').prop('disabled', false);
    $("#blok").show();
    $('#villa input').prop('disabled', true);
    $("#villa").hide();
}
Sponsor our Newsletter | Privacy Policy | Terms of Service