CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Help (Text Posting Form)

  1. #1
    Join Date
    May 2006
    Posts
    306

    Help (Text Posting Form)

    Ok, i think i have all the stuff for the form
    Code:
    <form name="strategyform"action="http://www.mediamax.com/tigermonkey/Hosted/strategies.php" method="post">
       <textarea name = "strategy" cols = "30" rows = "20"></textarea>
       <br>
       <button name = "submit" type = "submit">Post</button>
    </form>
    but what do i put for the other page that gets the text?

    heres a simple example, its what i found is the closest
    http://pyrom.net/test/blame.php

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,943

    Re: Help (Text Posting Form)

    Well, first, you need your code right. No spaces around equals signs in HTML.
    Code:
    <form name="strategyform" action="http://www.mediamax.com/tigermonkey/Hosted/strategies.php" method="post">
       <textarea name="strategy" cols="30" rows="20"></textarea>
       <br>
       <button name="submit" type="submit">Post</button>
    </form>
    What exactly are you trying to do on the other page. If you just want to get the text with the server use...
    PHP Code:
    <?php
    $strategy 
    $_POST['strategy'];

    echo 
    $strategy;
    ?>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    May 2006
    Posts
    306

    Re: Help (Text Posting Form)

    Get the text thats in the form, and send it to another page just to add on to it

    Button Click = Send To Page -----> Other Page - Add textarea text to page
    does it have to be a script kind of page, or can the text be added to another html

    ill try your code

  4. #4
    Join Date
    Sep 2006
    Posts
    28

    Re: Help (Text Posting Form)

    Quote Originally Posted by code?
    Get the text thats in the form, and send it to another page just to add on to it

    Button Click = Send To Page -----> Other Page - Add textarea text to page
    does it have to be a script kind of page, or can the text be added to another html

    ill try your code
    I see what you mean. When you make your form, you need a php program to parse the stuff you send it to it, and have it do stuff. Basicly, the code he provided will do nothing other then display it back in the browser. If you want it to add onto another page, then you would need to make a script that will write to a file.
    Let me make you a sample code:
    Code:
    <?php
    $strategy = $_POST['strategy'];
    //To add a break so it goes to the next line use this line instead:
    //$strategy = "<br />" . $_POST['strategy'];
    
    $filename = 'filetowriteto.html';
    
    if (!$handle = fopen($filename, 'a'))
    {
          echo "Cannot open file ($filename)";
          exit;
    }
    
    if (fwrite($handle, $somecontent) === FALSE)
    {
         echo "Cannot write to file ($filename)";
         exit;
    }
       
    echo "Success, wrote ($somecontent) to file ($filename)";
      
    fclose($handle);
    ?>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)