Few things: 1) you're splitting on an empty string right ? That way you'll get all the letters in that array, not a good thing 2) you're not quoting your form data so your script is insecure. 3) log your code and you'll see you'll be able to solve problems yourself much often than now