rsammy Posted May 22, 2009 Share Posted May 22, 2009 i am working on a php page where i need to populate a field (<tr></tr> tags) based on the flag value of another field. i have a field: Do you own a car? The input is the result from a radio button (Yes/No). If No, do nothing. But if user chooses, Yes, then I am setting a flag ($carFlag) to true. <tr> <td width="30%" height="40" valign="top"> Do you own a car? </td> <td valign="top"> Yes <input type="radio" name="car" id="car" value="Yes" <?php echo (($car=='Yes')?"checked":""); $carflag=='True';?>> No <input type="radio" name="car" id="car" value="No" <?php echo (($car=='No')?"checked":"");?>> <a href="" onclick="javascript:return popup()"><span style="font-size:10px;">What is it?</span></a> </td><br> </tr> if car flag is true, then the another field, 'make and model' should be displayed for user to enter information.l How do I do this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/159295-populate-field-based-on-flag-value/ Share on other sites More sharing options...
Ken2k7 Posted May 22, 2009 Share Posted May 22, 2009 Change $carflag == 'True'; to $carflag = true; Quote Link to comment https://forums.phpfreaks.com/topic/159295-populate-field-based-on-flag-value/#findComment-840120 Share on other sites More sharing options...
rsammy Posted May 22, 2009 Author Share Posted May 22, 2009 thanks much for your reply. it hides the field but, does not populate when i choose 'yes' as the option for the question: Do you own a car? Is it because PHP will only show this up when we do a POST? should i use javascript instead? if yes, can you or someone here please help me out? thanks again... Quote Link to comment https://forums.phpfreaks.com/topic/159295-populate-field-based-on-flag-value/#findComment-840255 Share on other sites More sharing options...
Masna Posted May 22, 2009 Share Posted May 22, 2009 http://www.google.com/search?source=ig&hl=en&rlz=&q=onChange&btnG=Google+Search&aq=f&oq= Quote Link to comment https://forums.phpfreaks.com/topic/159295-populate-field-based-on-flag-value/#findComment-840259 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.