0

Can anyone suggest something I am using osclass opensource. I don't know why conditions not working.

<button type="button" class="button-ii" <?php if(osc_item_formated_price()=="Only Information Available" || $email == "OFF")  {?> disabled="true" <?php } ?><?php>data-toggle="modal"disabled data-target="#myModal">Enquiry</button>
1
  • Welcome to SO, What have you tried to achieve your wanted results? What has your research concerning your problem shown? Can you provide code of your tries? Please provide a Minimal, Complete, and Verifiable example wherever required. Also please take the time to read How to Ask Commented Jan 27, 2018 at 5:02

2 Answers 2

1

Because you doing a wrong practice with PHP code you have an Extra <?php within button try this code may this help you either.

<button type="button" class="button-ii" 
<?php if(osc_item_formated_price()=="Only Information Available" || $email == "OFF")  
{?> disabled="true" <?php } ?> >data-toggle="modal"disabled data-target="#myModal">Enquiry</button>
Sign up to request clarification or add additional context in comments.

Comments

0

Try doing it with different approach,

<?php if(osc_item_formated_price()=="Only Information Available" || $email == "OFF") { ?>
    <button type="button" class="button-ii" disabled>Enquiry</button>
<?php } else { ?>
    <button type="button" class="button-ii" data-toggle="modal" data-target="#myModal">Enquiry</button>
<?php } ?>

OR

<?php if(osc_item_formated_price()=="Only Information Available" || $email == "OFF") { 
    echo '<button type="button" class="button-ii" disabled>Enquiry</button>';
} else {
    echo '<button type="button" class="button-ii" data-toggle="modal" data-target="#myModal">Enquiry</button>';
}

EDIT: I also want to point out that you need to change disable=true to disabled.

And this line data-toggle="modal"disabled does not make sense, remove disabled after data-toggle="modal".

You also have an extra php opening tag here <?php>data-toggle="modal"disabled without a closing. You should remove that refer to the code above.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.