1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

form that displays result in text area

Discussion in 'HTML & Website Design' started by muchochiz, Dec 12, 2014.

  1. #1
    Hi guys
    I have no idea how to go about this but I would like to create a form that displays results in the text area . For example if a user fills up his/her details on the form and clicks the submit button , his/her information would be displayed in the text area and if the detail isn't recorded / registered then a negative result would display in the text area. Here is an image illustration of what I'm trying to create. I would really appreciate some assistance with this.
    Thanks in advance :)



    [​IMG]
     
    muchochiz, Dec 12, 2014 IP
  2. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #2
    1) if that returned content isn't user editable, it has no business in a textarea.

    2) to do it without a page refresh from the form, that's a JavaScript question as you'd need to use AJAX

    3) though first you should make it work without scripting by sending the form and then sending the page back with the result filled in. Remember if you can't make it work without scripting FIRST, you likely have no business adding scripting to it.

    But really like any form, you have to submit the form's data FIRST, which means server-side processing using something like PHP, Perl or ASP.
     
    deathshadow, Dec 12, 2014 IP
  3. muchochiz

    muchochiz Active Member

    Messages:
    148
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    Could you please help with a basic simple script that could do this ? Thanks in advance.
     
    muchochiz, Dec 13, 2014 IP
  4. ketting00

    ketting00 Well-Known Member

    Messages:
    772
    Likes Received:
    27
    Best Answers:
    3
    Trophy Points:
    128
  5. JoshMillerEnterprises

    JoshMillerEnterprises Greenhorn

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    I am using that you will want to offer this for for multiple users, therefore, you need a database, the best thing to get is MySQL database.

    Next up, you will want to use PHP to check the information against the database by querying the database.

    Then you may want to use AJAX to keep it all nice and smooth without a page reload, which will require jQuery for calling the response from the .php file that you have coded; I don't suggest that you delve into AJAX just yet though. Stick with PHP and MySQL first, get that working and then see you can cook up with jQuery.
     
    JoshMillerEnterprises, Dec 14, 2014 IP
  6. ketting00

    ketting00 Well-Known Member

    Messages:
    772
    Likes Received:
    27
    Best Answers:
    3
    Trophy Points:
    128
    #6
    Here's the example:
    index.html:
    
    <!DOCTYPE html>
    <html>
        <head>
            <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
            <meta charset="UTF-8">
            <title>Just Test</title>
            <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        </head>
        <body>
            <button id="button">Test</button>
            <div id="log"></div>
            <script src="js/test.js"></script>
        </body>
    </html>
    
    Code (markup):
    test.js:
    
    $("button").click(function(){
        $.ajax({
            url: "test.html",
            type: "GET",
            success: function(msg){
                $("#log").html(msg);
            }
        });
    });
    
    Code (markup):
    test.html
    
    This is test message.
    
    Code (markup):
    That's simple.
     
    ketting00, Dec 16, 2014 IP