Home About Links Contact Info Blog / Articles

Articles

2/16/2011 - Strange Oddity in Form Submissions

Hey guys, this is more of a how to troubleshoot strange form oddities or errors when submitting forms on a website.  I have been working in the web design field what seems like forever, when I started learning how to program websites using HTML / CSS / javaScript / ASP / PHP, I started to learn of all the things that you can really do on the web, and it was getting more and more exciting as time went on.

With that, I just built a form a few weeks ago that would submit data and send it off to an email.  Not a huge deal, and nowhere near tough to handle.  But, I was then noticing every email that came through, there was a random comma in the same place.

Looking into it, I found the solution.  When working with forms, you typically have a few different tags that you will work with.

For Instance:
<form action="file you are submitting data to" method="post or get">

First Name: <input type = "text" name = "fname"><br />

Last Name: <input type = "text" name = "fname"><br />

</form>

Now, in this situation the input boxes both have a name assigned to the input box, and they are the same (fname).  In a situation like this, it will assume that they are named the same, but have two instances of that same field.

So, the program created to accept this data will put the information into an email, as Jake,Siegel instead of two separate values of Jake Siegel.

So, this is what the email would look like:
First Name: Jake, Siegel
Last Name:

And what you want the email to look like:
First Name: Jake
Last Name: Siegel

I hope this helps someone that may have been pulling their hair out!


Tags: random comma in submission, html, strange oddity

jake@jakesiegel.com

Permanent Link to Strange Oddity in Form Submissions

Archives:
August 2012
June 2012
April 2012
July 2011
February 2011
December 2009
November 2009