I need some HTML help

Discussion in 'HTML & Website Design' started by Emperor, Sep 12, 2007.

  1. #1
    I'm creating a simple form on my site, example.

    Your name:
    Age:
    Sex:
    Send

    and wanted to know if there's a way I can have the information appear in a simple box so the user can copy past the information.
     
    Emperor, Sep 12, 2007 IP
  2. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You mean like a text box?

    
    <textarea rows="6" cols="32">Your name:
    Age:
    Sex:</textarea>
    
    HTML:
     
    Noddegamra, Sep 12, 2007 IP
    Emperor likes this.
  3. Emperor

    Emperor Guest

    Messages:
    4,821
    Likes Received:
    180
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, after the user presses SEND I wanted the information to be displayed in a box "text box" so that he can copy pat the information.
     
    Emperor, Sep 12, 2007 IP
  4. mikebrad0927

    mikebrad0927 Peon

    Messages:
    266
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    are you using "post"?
     
    mikebrad0927, Sep 12, 2007 IP
  5. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #5
    okay, setup a form that uses POST.

    example:
    <form name="emailer" method="post" action="contact.php">
    PHP:
    Have input fields like:
    <input type="text" name="sender_name" size="30" />
    <input type="text" name="sender_age" size="30" />
    <input type="text" name="sender_sex" size="30" />
    PHP:
    Have a SEND button like:
    <input type="submit" name="email_page" value="Submit" />
    PHP:
    Then end the form
    </form>
    PHP:



    On contact.php use this code:

    
    <?php
    if(isset($_POST['email_page']))
    {
    $sender_name = $_POST['sender_name'];
    $sender_age = $_POST['sender_age'];
    $sender_sex = $_POST['sender_sex'];
    ?>
    
    <textarea rows="6" cols="32">
    Your name:<?php echo $sender_name; ?>
    Age:<?php echo $sender_age; ?>
    Sex:<?php echo $sender_sex; ?>
    </textarea>
    
    <?php
    }
    ?>
    
    PHP:

    :)
     
    Noddegamra, Sep 12, 2007 IP
  6. Emperor

    Emperor Guest

    Messages:
    4,821
    Likes Received:
    180
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Noddegamra thanks for your help, that's sort of what I was looking for.

    This is what I wan to do on my site.

    Users will be presented with a form.

    Name:
    Age:
    Birth:
    Sex:
    send information

    After filling the form and pressing send I want something ,like this to appear.

    My name is "name" and I'm "age".

    The name and age should be information he provided in the form.

    The last part of what I want to do is have it all printed so he can copy past the complete sentence.
     
    Emperor, Sep 12, 2007 IP
  7. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Noddegamra gave you an answer that can be adapted to do exactly what you're asking for, just keep in mind that you should not directly redisplay user input on a page EVER. You may want to read a very simple PHP tutorial.
     
    Gordaen, Sep 12, 2007 IP
    Emperor likes this.
  8. Emperor

    Emperor Guest

    Messages:
    4,821
    Likes Received:
    180
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks, I found a similar tutorial on another site and got things going. All I wanted to do is finish of by having the message displayed in a nice box for my readers to copy/past.
     
    Emperor, Sep 12, 2007 IP
  9. Noddegamra

    Noddegamra Peon

    Messages:
    1,013
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Yes. Always make sure you validate input and prevent browser hacking attempts. But for now, it's beyond the scope of my answer.


    for your desired result you need to replace the textarea bit with (for example):

    
    <textarea rows="6" cols="32">
    <p>Hi, my name is <?php echo $sender_name; ?> and I am <?php echo $sender_age; ?> years old.</p>
    </textarea>
    
    PHP:
    Remember, once you have recieved the data, you can always output it as you want. There are no limitations to how you can present it (within reason).


    If you want to learn more about PHP, HTML, and forms I highly recommend looking at the easy-to-follow tutorials provided by http://www.tizag.com/phpT/

    :)
     
    Noddegamra, Sep 13, 2007 IP
  10. Emperor

    Emperor Guest

    Messages:
    4,821
    Likes Received:
    180
    Best Answers:
    0
    Trophy Points:
    0
    #10

    I did manage to get everything working fine, the only problem I'm still facing is the way in which the results are displayed after pressing the submit query button. Currently it opens an ugly white windows with the desired information, go here and fill the form to see if you want. I'm still having a few problems getting that same information to appear bellow the form in a textbox insted of opening a new window.

    That's the site I used to get my information, it was very helpful.
     
    Emperor, Sep 13, 2007 IP
  11. katro

    katro Active Member

    Messages:
    451
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #11
    you can find tons of script at hotscript.com , it's time not to coding anymore :p

    Peace
     
    katro, Sep 13, 2007 IP
  12. undir

    undir Peon

    Messages:
    696
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Why dont you try googling for it. I am sure youll find a script for what you want
     
    undir, Sep 13, 2007 IP
  13. Emperor

    Emperor Guest

    Messages:
    4,821
    Likes Received:
    180
    Best Answers:
    0
    Trophy Points:
    0
    #13
    The reason I'm not opting for a ready made form is that I want to learn how to do it myself. It's something that I wanted to do by hand to see how it works.
     
    Emperor, Sep 13, 2007 IP
  14. undir

    undir Peon

    Messages:
    696
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Have you tried using any of the codes above. Can you read the code?
     
    undir, Sep 13, 2007 IP
  15. Emperor

    Emperor Guest

    Messages:
    4,821
    Likes Received:
    180
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Hi undir please take a look at my site, you'll understand better what I'm trying to do.

    This is all the code I currently have on my firm.


    The Form:

    <script type="text/javascript" src="prototype.js"></script>
    <script type="text/javascript">
        function Process(form) {
            var myAjax = new Ajax.Updater(
                "container",
                "form.php",
                {
                    method: "post",
                    parameters: {
                        name: form.name.value,
                        age: form.age.value,
                    }
                }
            );
            return false;
        }
    </script>
    <table>
    <form action="code.php" method="post" onsubmit="Process(this); return false;">
    <tr><td>Paypal ID:</td><td><input type="text" name="ID"></td></tr>
    <tr><td>Item name:</td><td><input type="text" name="Item"></td></tr>
    <tr><td>Item number:</td><td><input type="text" name="Number"></td></tr>
    <tr><td>Currency: </td><td>
      <select name="Currency">
        <option>USD</option>
        <option>EUR</option>
        <option>CAD</option>
      </select></td></tr>
    <tr><td>Cost: </td><td><input type="text" name="Cost"></td></tr>
    <tr><td>Cicle:</td><td><input type="text" name="Cicle"></td></tr>
    <tr><td>Cicle unit: </td><td>
      <select name="CicleU">
        <option>M</option>
        <option>Y</option>
        <option>D</option>
      </select></td></tr>
    <tr><td> <input type="submit"></td></tr>
     
      </form>
    </table> 
    Code (markup):

    Code.php:


    <html>
    <body>
    https://www.paypal.com/cgi-bin/webscr?cmd=_xclick-subscriptions&business=<?php echo $_POST["ID"]; ?>
    %20&item_name=<?php echo $_POST["Item"]; ?> 
    &item_number=<?php echo $_POST["Number"]; ?>
    &no_shipping=1&no_note=1currency_code=<?php echo $_POST["Currency"]; ?> 
    &bn=PP%2dSubscriptionsBF&charset=UTF%2d8&a3=<?php echo $_POST["Cost"]; ?>
    &p3=<?php echo $_POST["Cicle"]; ?>
    &t3=<?php echo $_POST["CicleU"]; ?>&src=1&sra=1 
    </body>
    </html>
    Code (markup):

    This is what I want to have at the end example
     
    Emperor, Sep 13, 2007 IP
  16. undir

    undir Peon

    Messages:
    696
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #16
    This uses ajax. Do you want to do it in ajax? Ill write something for you if you want. Just give me till tomorrow. OK?
     
    undir, Sep 13, 2007 IP
  17. Emperor

    Emperor Guest

    Messages:
    4,821
    Likes Received:
    180
    Best Answers:
    0
    Trophy Points:
    0
    #17
    The code I have there was taken from this thread. I've been trying to follow everyone's help but it never seems to work at the end. You don't have to right the code for me but if you think that's the best option I really appreciate it. My idea was to create something really simple but I guess it turned out a little more complicated than I expected.
     
    Emperor, Sep 13, 2007 IP
  18. mikebrad0927

    mikebrad0927 Peon

    Messages:
    266
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #18
    I think you have a little problem with your syntax, you should not be redirecting to code.php. You should include that code in form.php
     
    mikebrad0927, Sep 13, 2007 IP
  19. undir

    undir Peon

    Messages:
    696
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #19
    undir, Sep 13, 2007 IP