Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Output html and echo fieldset from form entries

    So I've been playing around with this idea to have a user enter information into your standard online form, something along these lines:

    <p>
    Send me some comments.
    <p>

    <form ACTION=" ? not sure? " method="post or get?" >

    <HR>
    Your name:<br>
    <input name="name" type="text" size=60> <br>

    <p>
    Your email address:<br>
    <input name="email" type="text" size=60> <br>

    <p>
    Your comments?<br>
    <textarea name="comments" COLS=60 ROWS=8></textarea><br>

    <p>
    <input type="submit" value="Send">
    <input type="reset" value="Clear">
    </form>

    Now here's where the javascript comes in for the form handling, but I'm just getting onto the onramp with javascript if you know what I mean. I'd like the javascript to take control of the form data once someone hits submit and then on the next page (or even in a pop up), output the fields and data with the html tags in place so that someone can just cut and paste into an html page and have the questions and the inputted data properly formatted.

    Is this doable? Thanks

    David

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jeeplaw View Post
    So I've been playing around with this idea to have a user enter information into your standard online form, something along these lines:

    <p>
    Send me some comments.
    <p>

    <form ACTION=" ? not sure? " method="post or get?" >

    <HR>
    Your name:<br>
    <input name="name" type="text" size=60> <br>

    <p>
    Your email address:<br>
    <input name="email" type="text" size=60> <br>

    <p>
    Your comments?<br>
    <textarea name="comments" COLS=60 ROWS=8></textarea><br>

    <p>
    <input type="submit" value="Send">
    <input type="reset" value="Clear">
    </form>

    Now here's where the javascript comes in for the form handling, but I'm just getting onto the onramp with javascript if you know what I mean. I'd like the javascript to take control of the form data once someone hits submit and then on the next page (or even in a pop up), output the fields and data with the html tags in place so that someone can just cut and paste into an html page and have the questions and the inputted data properly formatted.

    Is this doable? Thanks

    David

    kinda like a preview popup? or you want the code to be copied exact with the values inserted into the form elements?
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #3
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yea, a preview popup with all the html tags intact and values from the user submitted in the form elements.

    So if someone entered:

    Your name: Bob Johnson
    Your email address: bj@hotmail.com
    Your comments: This rocks!

    The output would be something like:

    Your name: Bob Johnson </br>
    Your email address: bjhotmail.com </br>
    Your comments: This rocks! </br>

    So that if I copied and pasted it into an html code page, the line breaks would be formatted.




    Quote Originally Posted by rlemon View Post
    kinda like a preview popup? or you want the code to be copied exact with the values inserted into the form elements?

  • #4
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jeeplaw View Post
    Yea, a preview popup with all the html tags intact and values from the user submitted in the form elements.

    So if someone entered:

    Your name: Bob Johnson
    Your email address: bj@hotmail.com
    Your comments: This rocks!

    The output would be something like:

    Your name: Bob Johnson </br>
    Your email address: bjhotmail.com </br>
    Your comments: This rocks! </br>

    So that if I copied and pasted it into an html code page, the line breaks would be formatted.
    try this:

    PHP Code:
    <?
    if(isset($_POST['Send']))
    {
        print 
    "Your name: " $_POST['name'] . "&lt;BR /&gt;\n";
        print 
    "Your email address: " $_POST['email'] . "&lt;BR /&gt;\n";
        print 
    "Your comments:&lt;BR /&gt;\n" $_POST['comments'] . "&lt;BR /&gt;\n";
    } else {
    ?>
    <p>
    Send me some comments.
    <p>

    <form ACTION="<?= $_SERVER['PHP_SELF'?>" method="POST" >

    <HR>
    Your name:<br>
    <input name="name" type="text" size=60> <br>

    <p>
    Your email address:<br>
    <input name="email" type="text" size=60> <br>

    <p>
    Your comments?<br>
    <textarea name="comments" COLS=60 ROWS=8></textarea><br>

    <p>
    <input type="submit" value="Send">
    <input type="reset" value="Clear">
    </form>
    <?
    }
    ?>
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #5
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm..not quite. After hitting send it just reloads the screen and the fields are empty

    Quote Originally Posted by rlemon View Post
    try this:

    PHP Code:
    <?
    if(isset($_POST['Send']))
    {
        print 
    "Your name: " $_POST['name'] . "&lt;BR /&gt;\n";
        print 
    "Your email address: " $_POST['email'] . "&lt;BR /&gt;\n";
        print 
    "Your comments:&lt;BR /&gt;\n" $_POST['comments'] . "&lt;BR /&gt;\n";
    } else {
    ?>
    <p>
    Send me some comments.
    <p>

    <form ACTION="<?= $_SERVER['PHP_SELF'?>" method="POST" >

    <HR>
    Your name:<br>
    <input name="name" type="text" size=60> <br>

    <p>
    Your email address:<br>
    <input name="email" type="text" size=60> <br>

    <p>
    Your comments?<br>
    <textarea name="comments" COLS=60 ROWS=8></textarea><br>

    <p>
    <input type="submit" value="Send">
    <input type="reset" value="Clear">
    </form>
    <?
    }
    ?>

  • #6
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    forgot to add a name to the submit button.

    this works

    tested on http://rlemon.com/_garbage/test.php (link will be removed later. you can see it there for the time being)

    PHP Code:
    <?
    if(isset($_POST['Send']))
    {
        print 
    "Your name: " $_POST['name'] . "&lt;BR /&gt;<br />\n";
        print 
    "Your email address: " $_POST['email'] . "&lt;BR /&gt;<br />\n";
        print 
    "Your comments:&lt;BR /&gt;<br />\n" $_POST['comments'] . "\n";
    } else {
    ?>
    <p>
    Send me some comments.
    <p>

    <form ACTION="<?= $_SERVER['PHP_SELF'?>" method="POST" >

    <HR>
    Your name:<br>
    <input name="name" type="text" size=60> <br>

    <p>
    Your email address:<br>
    <input name="email" type="text" size=60> <br>

    <p>
    Your comments?<br>
    <textarea name="comments" COLS=60 ROWS=8></textarea><br>

    <p>
    <input type="submit" name="Send" value="Send">
    <input type="reset" value="Clear">
    </form>
    <?
    }
    ?>
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #7
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Awesome, works perfectly Now, for one final question..is it possible to make hidden text in the form visible once they hit the submit button so that I can put a linkback to my website at the bottom of the form?

    Quote Originally Posted by rlemon View Post
    forgot to add a name to the submit button.

    this works

    tested on http://rlemon.com/_garbage/test.php (link will be removed later. you can see it there for the time being)

    PHP Code:
    <?
    if(isset($_POST['Send']))
    {
        print 
    "Your name: " $_POST['name'] . "&lt;BR /&gt;<br />\n";
        print 
    "Your email address: " $_POST['email'] . "&lt;BR /&gt;<br />\n";
        print 
    "Your comments:&lt;BR /&gt;<br />\n" $_POST['comments'] . "\n";
    } else {
    ?>
    <p>
    Send me some comments.
    <p>

    <form ACTION="<?= $_SERVER['PHP_SELF'?>" method="POST" >

    <HR>
    Your name:<br>
    <input name="name" type="text" size=60> <br>

    <p>
    Your email address:<br>
    <input name="email" type="text" size=60> <br>

    <p>
    Your comments?<br>
    <textarea name="comments" COLS=60 ROWS=8></textarea><br>

    <p>
    <input type="submit" name="Send" value="Send">
    <input type="reset" value="Clear">
    </form>
    <?
    }
    ?>


  •  

    Posting Permissions

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