johng Posted March 26, 2007 Share Posted March 26, 2007 I am working on a page where I want to be able to enter a large amount of text into a textbox. I have tried height= and it didn't work, but I can't find anything else that even says anything about textbox heights. Here's the code I'm working with: echo "<form method=\"POST\" action='$action_name'>"; echo "<input type=\"text\" name=\"field1\" size=\"20\" height=\"30\"><br>"; echo "<input type=\"text\" name=\"field2\" size=\"50\" height=\"40\"><br>"; echo "<input type=\"submit\" name=\"submit\" value=\"Send Information\">"; echo "</form>"; Thanks! Quote Link to comment Share on other sites More sharing options...
mjlogan Posted March 26, 2007 Share Posted March 26, 2007 http://www.w3schools.com/tags/tag_textarea.asp Text area maybe, not text box. Quote Link to comment Share on other sites More sharing options...
jitesh Posted March 26, 2007 Share Posted March 26, 2007 <input type="text" style="height:200" /> Quote Link to comment Share on other sites More sharing options...
jitesh Posted March 26, 2007 Share Posted March 26, 2007 Or use textarea Quote Link to comment Share on other sites More sharing options...
johng Posted March 26, 2007 Author Share Posted March 26, 2007 The textarea worked great, couldn't get the height:200 to work though. Here's the corrected code now: <?php */ if (isset($_POST['submit'])) { $ho = (file_exists("files/$field1.txt"))?'a':'w'; // open with append if file exists $fp=fopen("files/$field1.txt",$ho); fwrite($fp, $_POST['field2']); fclose($fp); } echo "<form method=\"POST\" action='$action_name'>"; echo "<input type=\"text\" name=\"field1\" size=\"20\"><br>"; echo "<textarea type=\"text\" name=\"field2\" cols=\"50\" rows=\"15\"></textarea><br>"; echo "<input type=\"submit\" name=\"submit\" value=\"Send Information\">"; echo "</form>"; ?> Quote Link to comment Share on other sites More sharing options...
johng Posted March 26, 2007 Author Share Posted March 26, 2007 In case anyone else needed something like this, the code I just posted will create a text file where the first textbox is the name of the file and the second one is what is saved in the text file. Just thought I'd put that out there for anyone who was wondering or needed it. Quote Link to comment Share on other sites More sharing options...
Leeder Posted March 26, 2007 Share Posted March 26, 2007 "<?php */" ? I don't see what <?php does in this case.. Quote Link to comment Share on other sites More sharing options...
johng Posted March 27, 2007 Author Share Posted March 27, 2007 Sorry about that. That little guy shouldn't be there. I was working with some code above that, and had to comment it out, but to do so, I had to leave the php tag above in, therefore needing to comment the one shown in this code. The real code should be just this: <?php if (isset($_POST['submit'])) { $ho = (file_exists("files/$field1.txt"))?'a':'w'; // open with append if file exists $fp=fopen("files/$field1.txt",$ho); fwrite($fp, $_POST['field2']); fclose($fp); } echo "<form method=\"POST\" action='$action_name'>"; echo "<input type=\"text\" name=\"field1\" size=\"20\"><br>"; echo "<textarea type=\"text\" name=\"field2\" cols=\"50\" rows=\"15\"></textarea><br>"; echo "<input type=\"submit\" name=\"submit\" value=\"Send Information\">"; echo "</form>"; ?> Quote Link to comment 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.