8 Replies Latest reply on Jan 22, 2009 5:52 PM by Newsgroup_User

    Contact Form

    person98 Level 1
      Hello all, I am wanting to make a contact form with some type of spam protection but I don't know where I should go to get the code for one of theses. I can work with PHP and HTML also. Thanks in advance!
        • 1. Re: Contact Form
          person98 Level 1
          So any good code?
          • 2. Re: Contact Form
            Level 7
            this formmail script doesn't have it built in, but there are several
            modifications published for it.

            http://developerkarma.com/projects

            http://developerkarma.com/forums/phpformmail/modifications


            quick instructions on getting the basic script working
            [refer to the documention included in the download for much more detail]

            1)go to http://http://developerkarma.com/projects -->phpformmail
            download it.
            extract the ZIP file.
            **More detailed instructions are in the docs folder.
            **These shortcut instructions are for version 1.07 of the phpformmail
            script.

            2) open formmail.php in dreamweaver
            Make the following changes (in code view, turn line numbers on)

            2a)
            line 4,
            define('CHECK_REFERER', true);
            change to:
            define('CHECK_REFERER', false);
            reason: too many people use a firewall or Norton security to restrict this.

            2b)
            Line 43
            $referers = array('www.example.com', 'example.com');
            change to the domain name of your web site.
            reason: this probably isn't needed since we just turned the referrer
            checking off. but change it anyway.

            2c)  *this is to hard-code the recipient address into the php
            file, where it is totally invisible *
            Line 46
            $recipient_array = array();
            change to:
            $recipient_array = array('me' => 'youremailaddr...@example.com');
            **of course, replace youremailaddress@example.com  with the email address
            you want to receive the form data. Also note the single quote marks.
            reason: this sets the email address the form results will be sent to.
            You can also make a list of possible recipient alias values- see the readme
            in the docs folder.

            2d) give the script a default "From" address to use.
            Go to line 41
            Change:
            define('FROM', null);
            to:
            define('FROM', 'Example Name <myaddress@example.com>');
            substituting your name and email address.

            3) now do a File-->Save As and save this file to within this Local Site
            folder. save it as anythingyouwant.php

            4) in dw's File Panel, find anythingyouwant.php and upload it to the remote
            site.

            5) Now open your form html file in dreamweaver,

            5a)click the mouse into the form area, and select the <form> tag on the
            lower left margin of the design window.
            In the Property Inspector, it should now show the properties of the <form>
            tag. In the Property Inspector, to the right of the ACTION line, click the
            folder icon and browse to and select the anythingyouwant.php file
            you've saved to within this site.

            5b) now click within the form area and go to dw menu-->Insert-->Form
            Objects-->Hidden Field
            This inserts a hidden form field.
            In the property inspector, change the NAME/ID of this field to: recipient
            And the VALUE of this field to: me
            the code should look like:
            <input name="recipient" type="hidden" id="recipient" value="me">
            This tells the script to use the "me" recipient_alias value as the email
            address to send the form to.

            5c: Do you have a form field to collect the user's email address?
            If yes, if this field is named exactly "email" then the script will use the
            user's email as the reply to in the outgoing email

            6) Save and upload the form page.
            Try the form from the website.

            ***Note also- If you have any form fields that can accept multiple values,
            like a set of checkboxes with same name or a select list, they need to have
            a name/ID that ends in pipebrackets- such as name="my_form_field[]" so the
            script processes that field as an array


            --
            Alan
            Adobe Community Expert, dreamweaver

            http://www.adobe.com/communities/experts/



            • 3. Re: Contact Form
              person98 Level 1
              Thanks! Sadly, I can't get this to work with the form. Are there any other forms?
              • 4. Re: Contact Form
                Level 7


                > Sadly, I can't get this to work with the form.

                what does or doesn't happen?
                url to the form?

                --
                Alan
                Adobe Community Expert, dreamweaver

                http://www.adobe.com/communities/experts/



                • 5. Re: Contact Form
                  person98 Level 1
                  Well I have the PHP file which is fine...

                  http://pxlcreations.com/index/formmail.php

                  But I don't know how to build a form around it. I want it to have a field where users can enter in the description and one where they can enter in a title. I don't know how to make a form that uses the formmail.php to run it.
                  • 6. Re: Contact Form
                    Level 7


                    > But I don't know how to build a form around it.

                    read the dreamweaver help.

                    set the action of the opening form tag to the location of the formmail file.

                    form name="form1" method="post" action="formmail.php">
                    <p>

                    <input name="recipient" type="hidden" id="recipient"
                    value="a_valaid_recipient_alias">
                    <textarea
                    name="mydescription" id="mydescription">default text</textarea>
                    </p>

                    <p>
                    <select name="mylist[]" size="1" id="mylist[]">

                    <option value="one" selected>One</option>
                    <option
                    value="two">Two</option>
                    <option
                    value="three">Three</option>
                    </select>
                    </p>

                    <p>
                    <input type="submit" name="Submit" value="Submit">

                    </p>
                    </form>

                    --
                    Alan
                    Adobe Community Expert, dreamweaver

                    http://www.adobe.com/communities/experts/



                    • 7. Re: Contact Form
                      person98 Level 1
                      Oh, I am sorry but now see how this PHP is set up. I thought at first that I needed to put in a specific name for a input type but I now see that it has an array function. Thank you though! Also, my last question is this. I want to put in spam protection into this form where if the user enters the wrong code or something, it won't send it to us but will have them enter it again until they get that code right. I looked at the addons but it seems no one has updated them and I don't know how to contact any of them :-(
                      • 8. Re: Contact Form
                        Level 7
                        Image captcha

                        ://www.labbs.com/~clander/pfm/index.html

                        simple addition problem
                        http://developerkarma.com/forum/phpformmail/modifications/spam-check-easy-an
                        d-effective

                        --
                        Alan
                        Adobe Community Expert, dreamweaver

                        http://www.adobe.com/communities/experts/