Jump to content
Sign in to follow this  
DarraghR

Beginner PHP email submit form

Recommended Posts

Hi guys. I am very new to PHP and have little or no knowledge at the moment. Currently I have a live site but would like to add a email submit form that would send the users information to a certain email and number of emails. A file submit option would be handy too.

I have tried a few pre made scripts and templates but just cant figure out how to make any of them work. I use Dreamweaver to code and manage my live site.

Below is a picture of the message I am getting in Dreamweaver and a link to the script I am using.

http://www.freecontactform.com/email_form.php

 

scripyt.jpg

Share this post


Link to post
Share on other sites

For real simple, try something like the following.

<?php
if(!empty($_POST['subject']) || (!empty($_POST['message'])) ) {
    mail('youremail@example.com', $_POST['subject'], $_POST['message']);
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <title>ContactForm</title>
    </head>
    <body>
        <form method="post">
            <input type="text" name="subject" />
            <textarea rows="4" cols="50" name="message"></textarea>
            <button type="submit">Submit</button>
        </form>
    </body>
</html>

 

Share this post


Link to post
Share on other sites

Your DreamWeaver error message is telling that the site definition is incorrect. Go to Site > Manage Sites, select your site definition in the list, and click the edit button. You'll want to select the 'Servers' panel, select your server in that list, and click the edit button once again. There, update your server location, default path, username, and password, and click 'Test'. This will let you know whether or not the information you entered is valid and able to be used by DW.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.