Here, you’ll find chunks of PHP, MySQL, HTML, jQuery, JavaScript, and Ajax code that we’ve put together while working through various projects. Hopefully they’ll help you out in your coding adventures too. Displaying posts 1 through 25 of 91:

Get Access to IFrame Elements with JavaScript

Using a little JavaScript magic, you can target the iframe’s elements just like you would any element in the main page. » View Post

PHP Content-Type Headers

A list of commonly used HTTP headers, pre-formatted as PHP code for quick copying and pasting. » View Post

JavaScript Equivalent of PHP’s ucwords Function

This JavaScript function takes a string, converts it to lowercase, then capitalizes the first letter of each word. » View Post

Why is jQuery Not Working in Drupal 8?

Drupal | JavaScript | jQuery
Here’s a quick hack to get around the problem. » View Post

Collect and Save Electronic Signatures

JavaScript | PHP
This simple example will show you exactly how to collect an electronic signature from your users and save it as a PNG file using PHP. » View Post

Get and Set Query String Variables with JavaScript

Quick functions that will let you both get data from the query string in JavaScript, and also to update that query string. » View Post

Get File Size and File Name of Local Files with JavaScript

JavaScript | jQuery
With the HTML5 File interface, you can access filename and size of users' files — before they're uploaded. Here's how. » View Post

Is Facebook Spying on Our iPhone Photos?

Connecting the dots between a snapped cell phone photo and the same product in a Facebook ad. » View Post

Send Email via SMTP from PHP Using PEAR

Email | PHP
A more secure alternative to using PHP’s mail() function that will help keep your messages out of the spam filters. » View Post

Get Redirect URL with PHP

This function follows redirects (even multiple redirects) and returns the final destination URL as a string. » View Post

Scroll to Div with jQuery

JavaScript | jQuery
Find the top of an element on your page and scroll to it (without animation) using jQuery. » View Post

List of PHP Supported Time Zones

Data Dumps | PHP
An easy-to-copy display of all the supported zones, plus code that you can use to create your own dynamic list and HTML to populate a dropdown. » View Post

Regex Checking of Foreign Characters in PHP

How to handle extended characters (like the é in café) with regular expressions. » View Post

Set Colors of Links Within Bootstrap Alerts

Bootstrap | CSS
Bootstrap’s alerts work great, but links within them don’t match. This CSS changes that. » View Post

Zoom in on Hover with CSS

Use CSS to zoom in when a user hovers over div or image (and keep it from expanding). » View Post

Responsive Parallax Images

A quick tutorial on creating parallax images that scale down for mobile screens with CSS and jQuery. » View Post

Fade Between Two Backgrounds

CSS | JavaScript | jQuery | TweenMax
Using CSS and JavaScript, fade between two background images. Includes a working example. » View Post

Convert mcrypt Keys in PHP

Fix this error: Warning: mcrypt_decrypt(): Key of size 29 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported in file.php on line 30 » View Post

Simple PHP Upload Form

A tested and working form that allows for the user to upload a CSV file. Can be easily modified for other file types. » View Post

Facebook & Twitter Share Customized Text

Facebook | JavaScript | jQuery | Twitter
Use the share dialogs and JavaScript/jQuery to allow users to share content that they generated. » View Post

Load a Variable File Based on Query String with jQuery and Ajax

Ajax | JavaScript | jQuery
This example will show you how to include files based on query string parameters using only client-side scripts. » View Post

CSV to MySQL Queries PHP Function

This function lets you take giant CSV files that are too big for phpMyAdmin and break them up into a manageable size so that they can be processed. » View Post

Log in to MySQL via SSH

Linux | MySQL
How to access your MySQL database from the command line if you're using a shared host. » View Post

Increase phpMyAdmin Upload Size

Detailed steps showing how to modify php.ini so that you can upload bigger files into MySQL through phpMyAdmin. » View Post

Build a Spinning Wheel Loading Screen

This guide shows you how to implement a JavaScript loading spinner. No images or jQuery required! » View Post
» Next · End · Categories