I am trying to display a textbox when a checkbox is checked. I have 3 checkbox when any of the checkbox is checked it as to display a textbox for that particular checked checkbox. And then the value of checkbox and the textbox value which is entered as to be sent through php. How can I display the checked checkbox and textbox value in php. I am finding the difficulty in php how to display the checked checkbox and particular textbox value in php
Here is the code
<form action="" method="POST">
<div id="opwp_woo_tickets">
<input type="checkbox" class="maxtickets_enable_cb" name="opwp_wootickets[tickets][0][enable]" value="cxfdvbbxbccv">check1
<div class="max_tickets">
<input type="text" name="opwp_wootickets[tickets][0][maxtickets]">
</div>
<input type="checkbox" class="maxtickets_enable_cb" name="opwp_wootickets[tickets][1][enable]" value="xc bvcvbcvbnb">check2
<div class="max_tickets">
<input type="text" name="opwp_wootickets[tickets][1][maxtickets]">
</div>
<input type="checkbox" class="maxtickets_enable_cb" name="opwp_wootickets[tickets][2][enable]"value="cxrdyrty rty tr">check3
<div class="max_tickets">
<input type="text" name="opwp_wootickets[tickets][2][maxtickets]">
</div>
</div>
<input type="submit" name="submit" value="submit">
</form>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
index.js
jQuery(document).ready(function($) {
// STOCK OPTIONS
$('input.maxtickets_enable_cb').change(function(){
if ($(this).is(':checked'))
$(this).next('div.max_tickets').show();
else
$(this).next('div.max_tickets').hide();
}).change();
});
PHP
<?php
if(isset($_POST["submit"]))
{
$checkbox1=$_POST['opwp_wootickets'];
$chk="";
foreach($checkbox1 as $chk1)
{
$chk .= $chk1.",";
}
echo "$chk";
}