SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot Dandandandaman's Avatar
    Join Date
    Mar 2009
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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 - 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.

  2. #2
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    The PHP code listed in the tutorial listed seems adequate, maybe you should persevere with it some more?
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  3. #3
    SitePoint Zealot Dandandandaman's Avatar
    Join Date
    Mar 2009
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers Anthony, if nobody has any other views or any other suggestions I'll give it a go.

  4. #4
    SitePoint Zealot Dandandandaman's Avatar
    Join Date
    Mar 2009
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  5. #5
    SitePoint Member
    Join Date
    Nov 2009
    Location
    Aruba
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #6
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by slacle View Post
    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

  7. #7
    SitePoint Zealot Ethan-27's Avatar
    Join Date
    Jan 2011
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •