Archive for the PHP Category
0
There are times where you need to validate a form to a data stored in a database without the need to submit the form beforehand. The solution - Ajax (shorthand for asynchronous JavaScript and XML). For example, you are creating a user registration form where obviously, the username to choose from needs to be unique. Instead of validating the username after form submission, wouldn’t it be much friendlier if the form can validate itself from the server asynchronously in the background from a simple event such as on submit or unfocus event? In this post, I will be showing how you can the validate with Ajax using PHP/MySQL as your back-end. A table called user is created in the MySQL database which contains some dummy usernames. When user enters a username existed from this table, the form will prompt an error with message “Username already taken. Please try a different... Continue Reading
0
This class written in PHP is very useful when you want to display random images in your website. I’ve used this class to generate the Homepage image for an image gallery website. Because the homepage requires the image to be large and must follows specific width to caters the design, in this example 800px, then the class will need to have the following method: Get random row from uploaded images > get the filename and caption> check the file’s width >... Continue Reading
1


