siabanie Posted March 15, 2011 Share Posted March 15, 2011 Hi all, I wonder if anyone can give me some idea; I have a form with a drop down menu [bT,Virgin, None, Other] - When user select either [bT, Virgin,None] the textarea field will be disable. But when user select option [Other] the textarea will be available. How can I do this? .. .. <tr align="left" valign="top" <?php if ($_POST['action'] == "register") { if ($errornum[16] == "1") { echo 'class="error"'; } } ?>> <td>Who is your previous Internet Service Provider?</td> <td align="left"> <select name="oldprovider"> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == "") { echo "selected"; } } ?>> Select Provider..... </option><?php $prev_supplier="BT";?> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register"){ if ($_POST['oldprovider'] == "$prev_supplier") { echo "selected"; } } ?>> <?php echo $prev_supplier;?> </option><?php $prev_supplier="Virgin";?> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == "$prev_supplier") { echo "selected"; } } ?>><?php echo $prev_supplier;?> </option><?php $prev_supplier="None";?> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == "$prev_supplier") { echo "selected"; } } ?>><?php echo $prev_supplier;?> </option><?php $prev_supplier="Other";?> <option value="<?php echo $prev_supplier;?>" <?php if ($_POST['action'] == "register") { if ($_POST['oldprovider'] == "$prev_supplier") { echo "selected"; } } ?>><?php echo $prev_supplier;?> </option> </select> <br /><br /> <textarea name="oldprovider_text" cols="30" rows="2"> <?php if ($_POST['action'] == "register") { echo $_POST['oldprovider_text']; } ?> </textarea></td> </tr> Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/230705-enable-and-disable-textarea-field/ Share on other sites More sharing options...
Destramic Posted March 15, 2011 Share Posted March 15, 2011 I think possibly javascript/jquery would be the best way to do this...so your for would be dynamic and wouldn't have to reload its self...but i'm not the best on how to do it...so i'd suggest to try in google jquery disable button and it should help hopefully Quote Link to comment https://forums.phpfreaks.com/topic/230705-enable-and-disable-textarea-field/#findComment-1187776 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.