Jump to content

[SOLVED] Text Box Height


johng

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/44333-solved-text-box-height/
Share on other sites

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>";
?>

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.

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>";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.