Send Text from textarea to a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PHPstarter
    New Member
    • Jun 2009
    • 77

    Send Text from textarea to a form

    With form i dont mean file submit form.
    It is just a custom 'file box' i created.

    I have an upload file site where you input file, description etc.

    How is it possible to make so that the text put into an <input> area with name/id="sendInfo" will be put into the custom form in a field called 'getInfo' ?

    Thanks in advance if anyone can please show me an example of just this.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hi.

    Are you talking about just moving the text from one field into another one on the same page as you type it?
    If that is the case then:
    Code:
    <input onkeyup="document.getElementByID('other').value = this.value" />
    If not, please elaborate. Examples are always helpful.

    P.S. That is a Javascript solution, and as such depends on a browser capable/willing to execute Javascript... but that's not really a problem these days.

    Comment

    • PHPstarter
      New Member
      • Jun 2009
      • 77

      #3
      It is not on the same page of the site.

      example:
      Page one: file_uploader.p hp

      Page two: file_list.php

      in file_uploader.p hp you can upload a file as well as enter text into text areas for example to input file_author, description etc.

      in file_list.php there is a table set that will have the results of what was inputted into the text areas from file_uploader.p hp,

      so that when you finally click 'upload' or whatever i may call the button, all the info is relayed via php and pasted into the file_list table.

      So what I really need is an example of how to do this, send whatever may be in a field named/id=file_author from file_uploader.p hp to another field with the same name/id (if that works) in file_list.php

      thanks

      Comment

      • dlite922
        Recognized Expert Top Contributor
        • Dec 2007
        • 1586

        #4
        Learn the basics of uploading files with PHP by reading Tizag.com's PHP File Upload lesson.


        is that what you need? how to upload files?

        change your file_upload.php form's action to file_list.php. Get the file info and _POST info as you would normally.

        basic PHP/programming knowledge is required.

        Thanks,



        Dan

        Comment

        • PHPstarter
          New Member
          • Jun 2009
          • 77

          #5
          The focus isnt really as much on the actual 'file' upload, but there are other textareas inside the form that contain text submitted by the file uploader.

          the thing im really asking about is how to make that text transfer along with the file into the file_list?
          there is a mold i created with tables that will contain the file download and file info.

          Comment

          • dlite922
            Recognized Expert Top Contributor
            • Dec 2007
            • 1586

            #6
            All your other form inputs should work with $_POST.

            You can use $_POST along with $_FILE.

            Is that what you're asking?

            I'm not sure what you mean by make text transfer along the file into file_list.

            "file_list" : why a list?, do you have multiple file uploads?



            Dan

            Comment

            • Atli
              Recognized Expert Expert
              • Nov 2006
              • 5062

              #7
              Ok, not sure I quite follow you, but let me try...

              Lets say you have a form that uploads an image, and a name for that image:
              [code=php]
              <form action="process .php" method="post" enctype="mutlip art/form-data">
              <input type="file" name="theImage" /><br />
              <input type="text" name="theCaptio n" /><br />
              <input type="submit" />
              </form>[/code]
              And then, in the process.php file, you simply show the image, headed by the caption:
              [code=php]
              <?php
              $filePath = "c:\\tmp\\" .. $_FILES['theImage']['name'];
              move_uploaded_f ile($_FILES['theImage']['tmp_name'], $filePath);
              ?>
              <div>
              <h1><?php echo $_POST['theCaption']; ?></h1>
              <img src="<?php echo $filePath ?>" alt="The Image" />
              </div>[/code]

              Is that what you are after?

              Or are you perhaps talking about creating a list of items that have already been uploaded?

              Comment

              Working...