brax23 Posted August 8, 2008 Share Posted August 8, 2008 I'm having trouble with a bit of code. The code below shows I am producing 2 pull down menus and 2 text areas all on one row. I would like to adjust the width of the last input box and also number of rows it spans. I'm trying to use the 'textarea' tag but I can;t quite figure it out. Can anyone help please? echo "<form method='get' action='Time_3.php'>"; echo "<table border='0' width='50%' cellspacing='0' cellpadding='8'>"; echo " <tr>"; echo " <td><table border='0' width='100%' cellspacing='0'>"; echo " <tr>"; echo " <td width='5%'> </td>"; echo " </tr>"; echo " <tr>"; echo " <td width='5%'> </td>"; echo " <td width='95%'> </td>"; echo " </tr>"; echo " <tr>"; echo " <td colspan='1'><table border='0' width='40%'>"; echo " <tr>"; echo " <td>Project: </td>"; echo " <td>Task Code: </td>"; echo " <td>Time: </td>"; echo " <td>Description: </td>"; echo " <tr></tr>"; echo " <td>$members_list</td>"; echo " <td>$codes_list</td>"; echo " <td><input type='text' name='time1' > </td>"; echo " <td cols='2'> <input type='text' name='description1' ></td>"; echo " </tr>"; echo " </table></td>"; echo " </tr>"; echo " </table></td>"; echo " </tr>"; echo "</table>"; echo "<input type='submit' value='Submit' />"; echo "</form>"; Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/ Share on other sites More sharing options...
adam84 Posted August 8, 2008 Share Posted August 8, 2008 As of now you are not using a textarea. You are just using a textfield. To just a textarea the code is like this: <TEXTAREA COLS=10 ROWS=3 ID=txt>This shows up inside the text area!</TEXTAREA> Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/#findComment-611801 Share on other sites More sharing options...
brax23 Posted August 8, 2008 Author Share Posted August 8, 2008 Thank you adam84 this did work to adjust the text area. Please excuse my low knowledge level but I need to ask a couple more questions. I' using the code below after reading your hint.However, the <input type='text' name='description1> code shows up in the text box and I would like to enter data in the text area. Also, the "resized" text box is centering vertically in the middle of the row. Is it possible to have it align with the top of the row? Thanks very much for the help. <td><TEXTAREA COLS=100 ROWS=3 ID=txt><input type='text' name='description1'></TEXTAREA></td> Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/#findComment-611817 Share on other sites More sharing options...
brax23 Posted August 8, 2008 Author Share Posted August 8, 2008 This code allows me to control the length of the text field but I would still like to have the text box span several rows while aligning with the top of the row, if that make any sense. <td><input type='text'name='description1' size='100'/></td> Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/#findComment-611832 Share on other sites More sharing options...
adam84 Posted August 8, 2008 Share Posted August 8, 2008 Text in a text area <td> <TEXTAREA COLS=100 ROWS=3 ID=txt> The text you want to show up in a text area goes between the <textarea> tags </TEXTAREA> </td> To set an element to the top of a cell, <TR VALIGN=TOP> More info: http://www.htmlcodetutorial.com/tables/_TR_VALIGN.html To span a couple rows, you need to use ROWSPAN in your <TD> This should help you out: http://www.htmlcodetutorial.com/tables/index_famsupp_30.html FYI, a textarea doesnt have the attribute MAXLENGTH like a text field does, so if you want to set the character length of your text area you have to create/find a JS function that limits the input. Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/#findComment-611922 Share on other sites More sharing options...
brax23 Posted August 8, 2008 Author Share Posted August 8, 2008 Thank you adam84 for the help. Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/#findComment-611925 Share on other sites More sharing options...
TheFilmGod Posted August 9, 2008 Share Posted August 9, 2008 <td><TEXTAREA COLS=100 ROWS=3 ID=txt><input type='text' name='description1'></TEXTAREA></td> I really don't like this code. It uses tables , but the worse part is your use of "cols" and "rows." Such things should be styled through css. Lastly, the <input> tag is unnecessary to accomplish what you are trying to do. It simply defeats the purpose of the textarea. <textarea id="textarea1 name="textarea1">Please write something...</textarea> #textarea1 { width: 300px height: 50px; background: ...; etc. } Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/#findComment-612109 Share on other sites More sharing options...
haku Posted August 9, 2008 Share Posted August 9, 2008 the worse part is your use of "cols" and "rows." Such things should be styled through css. I agree, and they still can be, but cols and rows are required (by XHTML strict at least, don't know about transitional). Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/#findComment-612149 Share on other sites More sharing options...
TheFilmGod Posted August 9, 2008 Share Posted August 9, 2008 the worse part is your use of "cols" and "rows." Such things should be styled through css. I agree, and they still can be, but cols and rows are required (by XHTML strict at least, don't know about transitional). Really? I never really used textarea much before, so this is completely new to me... but why? Seems like an IE4 thing to me. Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/#findComment-612444 Share on other sites More sharing options...
haku Posted August 10, 2008 Share Posted August 10, 2008 It's always seemed weird to me too. I assume it's as a fallback for someone who has CSS turned off. I really don't know the why behind it though. Quote Link to comment https://forums.phpfreaks.com/topic/118815-textarea-help/#findComment-612868 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.