Hi all,
I bought this book 2 weeks ago and have starting reading it a few days back.
I am having a problem. I'm doing the review of the 2nd chapter but I modified the tasks a bit and I am in a quagmire with a function inside a function.
The problem is that I want the "checked" to be contained inside the <input checked="checked"> but instead it keeps reverting back to before the entire html output.
Relevant PHP
// function to control which radio button will be checked depending on the value entered by user function ifstatement1 ($value,$id) { if ( ($value < 5.7) && ($id==1) // checked first radio button OR (($value>5.7) && ($value <6.4)) && ($id==2) // checked second radio button OR ($value > 6.4 ) && ($id==3) // checked third radio button ) { echo "checked"; } } // Create radio button function function create_radio ($id, $name, $value, $description){ echo '<p><input type="radio" id="'.$id.'" name="'.$name.'" value="'.$value.'" checked="'. ifstatement1 ($value,$id).'" > '. $description .'</p>'; }
Any help will be appreciated,
Thanks