HTML Form input boxes clear when clicked

Friday, August 21st, 2009

Here’s a quick tip on clearing the default text from text boxes in a form.
First of all you can add the default text to a input box by declaring a value:
<input type=”text” value=”Enter Name” />
Now we can add an ‘onfocus’ event that will delete this value when the box is clicked, essentially by replacing it [...]




Div containing floating divs collapses

Friday, August 7th, 2009

After about an hour of trying to work out why the spacing between my posts was working in Internet Explorer but not in Firefox, I stumbled upon a common issue.
If a Div contains floating divs it will not resize the height to contain the floating divs. So adding padding to the containg div has no [...]




apt-get install sendmail fails

Tuesday, July 14th, 2009

I was getting an error message when trying to install sendmail on a linux server.
Using the command sudo apt-get install sendmail i was getting the following error:
The following packages have unmet dependencies:
sendmail: Depends: sendmail-bin (= 8.13.8-3) but it is not going to be installed
E: Broken packages
Easy fix, just type:
sudo apt-get install sendmail-bin
press ‘y’ and let [...]




Create Strings from XML using PHP.

Wednesday, July 1st, 2009

This code uses the simplexml function included in PHP 5.
It’s purpose is to create string variables from XML.
It only works properly as long as every xml tag is unique, if a tag is repeated it will overwrite and be useless to you.
here’s an example of what it does,
Sample XML:
<?xml version=”1.0″ encoding=”utf-8″ ?>
<newsignup>
<username>John Smith</username>
<password>p455w0rd</password>
</newsignup>
the code would [...]




PHP setcookie overwriting problem.

Wednesday, June 17th, 2009

I’ve just found a tiny error in how I’ve been taught to create cookies in PHP. So thought i’d share it incase it was driving anyone else crazy too.
Symptoms: cookie data is overwritten or not passed properly.
Solution: Firstly lets make sure you’re writing cookie’s properly.. (time is set to 30days)
 setcookie(’name’, ‘value’, time() + 3600*24*30);
It’s likely [...]




Wordpress.com, Wordpress.org or Drupal?

Sunday, June 14th, 2009

Choosing a CMS can be difficult, here i’ll take you through the basics and hopefully help you decide which is best for you.
I’ve always been a fan of wordpress. Starting with no experience of PHP and just some basic HTML and CSS skills, wordpress enabled me to create a dynamic site very quickly!
First off, there’s [...]