form processing question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ronald Raygun

    #1

    form processing question

    I have a form, which contains a textfield for a user to enter their
    username. I want to provide a button that allows the user to check to
    see whether that username has already been taken up by someone else (a
    bit like the functionality available when signing up for hotmail.com)

    My question is:

    1). How can I send the text entered in the text box to a server side PHP
    script?
    2). How do I receive the response (simple true or false) from the server
    side, back in the form?
  • =?iso-8859-1?Q?=C1lvaro?= G. Vicario

    #2
    Re: form processing question

    *** Ronald Raygun escribió/wrote (Fri, 09 May 2008 17:07:41 +0100):
    I have a form, which contains a textfield for a user to enter their
    username. I want to provide a button that allows the user to check to
    see whether that username has already been taken up by someone else (a
    bit like the functionality available when signing up for hotmail.com)
    >
    My question is:
    >
    1). How can I send the text entered in the text box to a server side PHP
    script?
    Hitting "Enter" ;-? But I presume you mean without reloading the current
    page. That's what they call AJAX. You need JavaScript to do it so it's
    beyond the scope of PHP, but it should not be too difficult if you get some
    pre-built code out there. You can either use a framework with AJAX
    abilities...




    .... or write the code yourself; in the latter, this can help:





    --
    -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
    -- Mi sitio sobre programación web: http://bits.demogracia.com
    -- Mi web de humor en cubitos: http://www.demogracia.com
    --

    Comment

    • Manuel Lemos

      #3
      Re: form processing question

      Hello,

      on 05/09/2008 01:07 PM Ronald Raygun said the following:
      I have a form, which contains a textfield for a user to enter their
      username. I want to provide a button that allows the user to check to
      see whether that username has already been taken up by someone else (a
      bit like the functionality available when signing up for hotmail.com)
      >
      My question is:
      >
      1). How can I send the text entered in the text box to a server side PHP
      script?
      2). How do I receive the response (simple true or false) from the server
      side, back in the form?
      You may want to take a look at this form class. It lets you submit the
      form without page reloading using AJAX. You can connect the textfield
      ONCHANGE event to the AJAX form submission.

      That makes it execute the same script that generated the form, except
      that your script will be able to tell whether the form is being
      submitted via AJAX so you can check the user name. In response, you can
      update any parts of the page to tell the user whether the name is taken.

      http://www.phpclasses.org/formsgeneration

      I don't have an example script to do exactly that, but there is one
      example script to submit the form via AJAX here:



      You may also want to watch this tutorial video:

      http://www.phpclasses.org/browse/vid...ugin-ajax.html


      --

      Regards,
      Manuel Lemos

      PHP professionals looking for PHP jobs
      http://www.phpclasses.org/professionals/

      PHP Classes - Free ready to use OOP components written in PHP
      http://www.phpclasses.org/

      Comment

      Working...