mardi 9 octobre 2018

Getting syntax error while managing the check boxes dynamically using PHP

I need to manage the check box input dynamically using php but it could not happen as expected. I am explaining my code below.

<div class="checkboxdiv">
                <input type="checkbox" id="carsval" value="1" name="carsval" <?php if($isCar==1){echo 'checked="checked"'} ?>>
                <label for="carsval">Cars</label>
                <div class="Clear"></div>
                <input type="text" class="form-control" id="carsprice" value="<?php echo $car_price; ?>"> name="carsprice" <?php if($isCar==1){echo 'style="display:block;"'}else{echo 'style="display:none;"'} ?>>
              </div>

Here My requirement is if $isCar value is 1 then that check box will be checked and the the text box will be displayed with the required price and if it is 0 the text box will not viewed and the check box will remain unchecked. But in my case its not happening like this. Please help me to resolve this issue.




Aucun commentaire:

Enregistrer un commentaire