Contact Form - PHP Query

Morning everyone.

I am pretty new to web design and haven’t even looked at Javascript or PHP yet. I am slowly building my first site and want to set up my first ever contact form, I have looked around to find the best way to do it. I did find a tutorial that I thought looked ok from a HTML point of view and I intend to change the css to how I want it. Stomme Poes has suggested that it would be worth somebody having a look from a PHP point of view.

Here is a link to the previous thread - Sitepoint Thread and here is the tutorial for the contact form - [URL=“”]Tutorial.

I did try to use Jotform as suggested but tried to make a load of changes to the css and hit a wall. I couldn’t figure out how to manipulate the error messages that were appearing, I think this was due to the javascript.

Anyway I digress. Any help would be appreciated or if anybody can point me to a contact form tutorial or template that is known to be a good build that I can use but also change the style that would be great.

Any help really would be appreciated.

The PHP code listed in the tutorial listed seems adequate, maybe you should persevere with it some more?

Cheers Anthony, if nobody has any other views or any other suggestions I’ll give it a go.

I have just worked through this and there are a few bits that are not working. I would be really grateful if somebody could have a look. I have just add the PHP and HTML code to the page of my website and then created the validate.class.php file. I have just copied and pasted the code and have removed the CSS. yet the following things are wrong

  1. It says “your message has been sent” even when no details have been completed, I assume this is meant to show only when the message has been sent but not sure how to fix it.
  2. Each field has already been filled in with Name having <?php echo htmlentities($name); ?> in it, Email is filled in with <?php echo htmlentities($email); ?> and then message is completed with <?php echo htmlentities($message); ?>. I assume it is an issue with the code but I am unsure how to fix it
    3)When I click submit it takes me to a folder showing all the files which form my site, I assume it shouldn’t be doing that but what should it be doing and how do I fix it

If anybody has any ideas please let me know where I am going wrong. I can’t put it on my live website just yet until I get home, so sorry if this causes a problem. Thanks in advance.

I would like to see a response to this thread as well.

There are tons of (good) tutorials about everything on web design out there, except for creating a simple contact form. All the ones I’ve been able to find are really old and probably outdated or from random websites which I wouldn’t trust.

I found a really simple but with PHP validation contact form here: Create A Simple PHP Contact Form

Some things to think about are:

1.Security, e.g sql injection,

2.What mistakes your user might make when typing into the texfields - “if” and “else” statements

3.Where you want to send it to e.g a database or a personal email.

Look into the ‘post’ and ‘get’ functions of php aswell. The “action” value in your HTML form is something to look up aswell as this is where the form will be sent e.g to a processing script.

I wish I had more to give you but Im still building one myself at the mo.