Aleix Cortadellas
A little bit of everything…-
Performing MySQL queries with the help of AJAX
Posted on April 6th, 2009 4 comments
Back to AJAX! This tutorial is a reply to a question posted in Experts Exchange, and therefore it has a very specific scope. However, taking into consideration it may prove to be useful to many, I decide to share it with you all.What this tutorial explains is how to perform asynchronously MySQL actions with AJAX, using GET variables and an external PHP page. It may sound super-complex, but it is not. As usual, I provide the full code of the script and a working demo which you can see here.
AJAX, Computers & programming, HTML, JavaScript, MySQL, PHP ajax, asynchronous, database, delete, div, insert, mysql, onclick, php -
Getting syntax highlighting plugins to work correctly with certain WordPress themes
Posted on April 1st, 2009 No commentsHappy April 1st! Note however that this is serious content; in my country we celebrate fools day the 28th December instead


If you’re running a WordPress blog, some themes – including the one used in this blog, which is Gear theme – might give you headaches when using syntax highlighting plugins (namely, plugins for showing source code in a well-organized and nicely formatted way). The problem? The code displayed is completely messed up. As far as I know, this happens with different plugins, and all of them are based on Alex Gorbatchev’s syntax highlighter. Read the rest of this entry »
-
Horse presentation at the Reiten-Jagen-Fischen fair in Erfurt, Germany
Posted on March 30th, 2009 No commentsThis is a short video I filmed last week in Erfurt, Germany, in occasion of the riding-hunting-fishing fair (Reiten-Jagen-Fischen) which was being celebrated from the 27th to the 29th March; the presentation appearing in the video was about different horse races and riding styles.
The background music is Enya.
In case you still didn’t get it; yes, I like horses a lot
-
Saving multiple selections from drop down list to database
Posted on March 20th, 2009 1 comment
This 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.
-
Custom data in EventList frontend event submission form
Posted on March 15th, 2009 2 comments
This is (a quickly written and) the last planned post of the EventList 1.0RC Component for Joomla 1.5 customization series, and in response to Junkah’s request. It explains how to add custom fields in the event submission form; the example below is a text field where the number of available places can be specified. The example only covers the process of saving the submitted number in the database, so that it can be kept for future reference. If you wish to prevent further registration of guests once the number has been reached, then you will have to write some extra code for that purpose, but as I said this is beyond the scope of this post.My apologies for not having all the free time I’d like to, for adding new contents more often and for writing with more details. Back to university, it’s all about priorities. It will be like this for some months, but I will do my best to keep up the knowledge sharing!
-
Checking availability of user name with AJAX
Posted on March 5th, 2009 9 comments
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.
-
Submit forms with POST method using AJAX
Posted on March 1st, 2009 21 comments
AJAX (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 »AJAX, Computers & programming, HTML, JavaScript, MySQL, PHP ajax, asynchronous, code, div, form, html, javascript, mysql, php, post, section, submit, web 2.0, xml -
Calculating age with JavaScript
Posted on February 28th, 2009 No comments
I’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…
-
Refreshing DIV content with AJAX (multiple DIVs)
Posted on February 25th, 2009 27 comments
After reading the post Refreshing DIV content with AJAX, you already know how to refresh the content of a DIV in your website with the help of AJAX. But perhaps you want to refresh more than one DIV, and you’ve realised the code in the other post didn’t work! Don’t panic, as a matter of a fact refreshing multiple DIVs is the same process than refreshing a single DIV. I’ve prepared an example and some code so you can see how easy it is. See the working demo here.AJAX, Computers & programming, HTML, JavaScript, PHP ajax, asynchronous, code, div, divs, html, javascript, multiple, php, refresh, reload, section, update, web 2.0, xml -
AJAXifying your site’s navigation
Posted on February 19th, 2009 9 comments
This post is inspired in Refreshing DIV content with AJAX. However this code does not actually automatically refresh the contents of a DIV but it refreshes them when the user clicks a link. The implementation of the code below allows to refresh the contents as mentioned, but the content retrieved can be different every time. This is very useful to make a website work in a similar way as with frames, but with more advantages and without the disadvantages of frames.I provide the code necessary to achieve this purpose but I don’t present it like a step-to-step tutorial. This is because I guess that for anyone with minimal knowledge of HTML and JavaScript is totally self-explanatory and because I would prefer you to make your website look like you want it to rather than like my post tells you to.
You can see a demo page with AJAX navigation here.



