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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.