Working On A Simple Chat Utility Get data from Form without refreshing page

Discussion in 'PHP' started by ATTECH, Jul 31, 2010.

  1. #1
    Hello,
    I was working on a simple chat utility and i am completely stuck.
    The only solution which i think can complete this chat is if i can get data of a form without refreshing the whole page somewhat like what facebook does i assume..

    So any suggestions?
    Also any suggestions if youll have for a basic chat utility, i already found one which had way too much complexity and used frames and stuff but it went totally over my head in terms of making better use of it.. i feel it can be done using easier methods..


    So if anyone can help me how to get Input From Form Without Refreshing The Form It would be great? or any other suggestions are fine too.
     
    ATTECH, Jul 31, 2010 IP
  2. devgex.com

    devgex.com Well-Known Member

    Messages:
    193
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    133
    #2
    Must say I don't quite understand what you are after...
    But for the submitting forms without refresh, there are in general speaking two ways to do it:
    -With Javascript - AJAX
    -With Frams - Here the actual refresh happens, but only for the page with the form, not the frame-holder page (you probably know that, but just in case)

    It depends on your needs when it comes to choosing but, I'd suggest javascript, use a more-friendly javascript approach with libraries, i.e. jQuery.

    Good luck
     
    devgex.com, Jul 31, 2010 IP
  3. ATTECH

    ATTECH Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Okay, basically i want to get input whatever string is entered in it when the submit button is pressed.
    On the same page. I dont think jquery will help me, i have tried a lot of things. I do not understand what i can do using <iframes> so any help?

    Thank You
    <form name="input" method="post" action="<?php echo $PHP_SELF;?>">
    Message:<input id="text" size="12" maxlength="12" name="message">
    <br />
    <button name="submit">Submit</button>
    </form>
     
    ATTECH, Jul 31, 2010 IP
  4. ChrisMac

    ChrisMac Peon

    Messages:
    28
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi, in your case Javascript is the only solution, and jQuery, prorotype or any other JS library will do it just fine. What you need to do is:

    1) Attach an event handler to your "submit" button
    2) The event handler will get current value of your "input" and send it using Ajax request to the web server
     
    ChrisMac, Aug 3, 2010 IP