Blog

Send E-mail with Attachment using PHP

Here’s a perfectly working snippet of PHP code which will send an e-mail with an attachment (of any file type). This code has been updated to disable jumbled/garbage/corruption which showed up on gmail (while it was fine on Outlook). //File settings $fileatt = “../uploads/myLovelyFile.pdf; $fileatttype = “application/octet-stream”; //Octet-stream is a file type to allow all types of files $fileattname = “myLovelyFile”; //Read file contents $file = fopen($fileatt, ‘rb’); $data =

Add Checkmarks to your Unordered List Items

You have a regular unordered which shows with bullet points just like this: HTML: <ul> <li>Apples</li> <li>Oranges</li> <li>Grapes</li> </ul> Result: Apples Oranges Grapes The bullet points are ugly and the check marks would be so much more relevant. Here’s how to turn the bullet points into checks. First, add a class like checkmark to the ul tag which will indicate when the checks should be applied. HTML: <ul class=’checkmark’> <li>Apples</li>

Default Value for Submitting Forms using “Get”

I have this form I’m working on for a client which transmits data to another site for scheduling and processing. The form needs to use the “get” method where all of the values are assigned as part of the url. The sending URL looks like this: http://www.kimberleygriffith.com?ZIP=12345&PRODUCT=2&QUANTITY=4 ZIP = 12345 PRODUCT = 2 QUANTITY = 4 The issue is that one value (zip code) when left empty, like this: http://www.kimberleygriffith.com?ZIP=&PRODUCT=2&QUANTITY=4

Customize any Form on WordPress using CSS

Have you installed a contact form plugin for WordPress and found the default layout is entirely boring? I’ve been there! The default layout comes with a very little or absolutely no css formatting. Below is the default layout for Ninja Forms. Luckily, I was able to write a snippet of code which will resolve that. The Solution to Customizing any Form on WordPress using CSS This snippet can work on

PHP Mail Special Characters in Subject Field

Let’s say you’d like to insert special characters in the subject of HTML e-mails sent with the PHP mail() function. You have an email subject which when extracted from my database looks like this.. Coffee &amp; Laptop Sample code.. $to = ‘me@example.com’; $subject = ‘Coffee &amp; Laptop’; $message = ‘HTML message…’; $headers = ‘MIME-Version: 1.0’ . “\r\n”; $headers .= ‘Content-type: text/html; charset=utf-8’ . “\r\n”; $headers .= ‘From: Me <me@example.com>’ .

CSS Media Queries for Mobile Devices

Writing CSS for different devices can be a pain in the ass. With Media Queries it’s easier, if you know how to pin point a specific device. This can help you pin point a specific mobile device from within your CSS. Copy the code and paste it into you CSS file and get crackin’! /* Smartphones (portrait and landscape) ———– */ @media only screen and (min-device-width : 320px) and (max-device-width

Your Desktop Site Will Look the Same!

I often receive requests from potential customers on making their website ‘mobile friendly’ or ‘mobile responsive. ‘Mobile responsive’ means the webpage reacts to the size of the device its being displayed on. In other words, a mobile responsive web page viewed from a tablet will look differently when viewed from a mobile phone. That’s because the two devices are extremely variant in size, and as a result, your web page

Vertically Align Anything with Just 3 Lines of CSS Code

Have you to vertically align an element and it just won’t work. vertical-align: middle; claims to do the trick but it won’t apply to every situation. .element { position: relative; top: 50%; transform: translateY(-50%); } That’s all you need! It works straight out of the box, even in Internet Explorer 9.