A little bit of everything…
RSS icon Home icon
  • Saving multiple selections from drop down list to database

    phpThis post will teach you how to process and store multiple selections from a form element into a MySQL database, using PHP. In order to understand how it works, you will need basic knowledge of PHP arrays, because they’re necessary for achieving the results.

    If you still don’t know what arrays are and how do they work, read Tizag’s array tutorial first.

    Read the rest of this entry »

  • Checking availability of user name with AJAX

    AJAX

    Lately I’ve been writing quite much about AJAX, but it is so useful that I’m sure it is of everyone’s interest!

    In this post I will show you – as the post title says – an example script of AJAXed registration form, without recurring to AJAX frameworks (there are already many tutorials about this topic in relation with them). The example omits the synchronous part of the registration and focuses on the user name, which we want to asynchronously check. It doesn’t sound so weird if I say it in other words: check on the fly if the user name the person is typing already exists in the database or not, and take actions depending on whether it does or not (for instance, only allow form submission if name is available).

    This is the basis for other types of effects like for instance searching contents and dynamically returning result suggestions, or checking if a specific word exists in the database, etc. but as I mentioned, here the intention is to use it on a registration form.

    Read the rest of this entry »

  • Submit forms with POST method using AJAX

    AJAXAJAX (Asynchronous JavaScript And XML) is a keystone of Web 2.0 and is very useful in many aspects, because it offers the possibility to change the structure of the page (DOM). For instance, it makes possible sending a form in a website without having to reload the whole page (’asynchronously‘ is the magic word here). The data submitted is processed and may be saved in a database just like classic forms do, but the user can continue browsing during the process.

    AJAX forms are a must-have for any AJAXed website. They can be used for many, many purposes: for checking whether a username already exists in the database; for seamlessly sending registrations, feedback or comments; or even for creating a shoutbox or chat script.
    Read the rest of this entry »

  • Calculating age with JavaScript

    JavaScript LogoI’ve been working on a simple form – nothing really challenging – where members of a group can provide some data about themselves for registration purposes. However I tried adding an extra function to it: a small text field next to where they input their birth data, which displays their age (according of course to the birth date they provided).

    I thought therefore I could share this small piece of code so that other people wishing to add it to their websites can use it. The internet is already full of such scripts, but who knows, maybe someone finds it here and finds it useful…

    Read the rest of this entry »