Hi,
I am new to PHP and have limited experience as this is my first project. I am creating an audit using a custom post type and ACF.
within my post template which will be the front end “report” I need to show a % score for the audit. Each audit question is answered yes or no. Example field name is q1_answer
I have the following code which looks at field q1_answer and if it is a yes displays a 1, however, I need the 1 to be the value of the variable so I can use it in my overall score calculation.
<?php if (get_field('q1_answer') == 'Yes') {
echo '1';
} ?>
Hi @lee-harvey
I am not sure that I have fully understood the description, is this what you are after?
<?php if (get_field('q1_answer') == 'Yes') {
$value = "1";
} ?>