October 23rd, 2012, 08:17 AM
Make radio button invisible using php?
This is my first post ever, so please be gentle...
I've been struggeling with the following problem. I have a form that contains a number of radio buttons. In some cases (depending on data in my sql database) I want some of the radio buttons to appear invisible (for a more user friendly form). Somehow I can't get it to work.
Below a (simplified) version of the code I am using so far:
Could you please help out a struggeling beginner?
//Then for the radio buttons I am using this line of code to get the style tag to match $visible (in this case "display:none;).
<input name="question1" value="1" style="<?php echo($visible); ?>" type="radio">
October 23rd, 2012, 08:20 AM
It's much easier to put your input-tag in an if-statement
EDIT: The variable $visible is a boolean with the result of your visible-conditions
echo "<input .... />"
October 23rd, 2012, 08:54 AM
It worked like a charm! You've made my day, thanks a bunch!
Originally Posted by SimonBlok