Reputation: 3
I have this site.
At the bottom you will find some products ... four of them have the word "buton1" or "buton2"
The site is made with this Wordpress plugin and custom fields.
Basically I have two radio buttons.
I want to put my button, depending on which item is selected, in the admin panel.
To do this, I tried the following code:
CODE PHP:
<p class="test"> <?php
$variable = get_field('button');
echo $variable;
if(buton1 is selected)
{
<a href="?page_id=26" class="get_quote">get quote</a> //display the button
}else if(buton2 is selected){
//hide the button
}
?>
You can help me please tell me what I should do to fill my code?
How can I verify that the button is selected?
Thanks in advance!
Upvotes: 0
Views: 59
Reputation: 1794
when a form is submitted, all the elements in the form are posted to the submitted page with name and values, in get
or post
scope. depending on the form type.
You can get the selected button as follows in php:
$button_value = get_field('button_name');
echo $button_value;
if($button_value == 1)
{
<a href="?page_id=26" class="get_quote">get quote</a> //display the button
}
else if($button_value == 2){
//hide the button
}
Upvotes: 1