# How do I create a simple form for contact information etc?



## Dano2 (Nov 30, 1999)

Hi, 
I use Dreamweaver CS3 and want to create a simple form for visitors to receive more information, like a field for Name and Email address. I think I can manage to figure out how to make the form fields using Dreamweaver but where can I get some free code to actually make it work? I am pretty much a newbie to this but am learning Dreamweaver..thanks in advance for any help....


----------



## namenotfound (Apr 30, 2005)

So you just want it to display for information, or do you want it to be functional (i.e. let people email you)?


----------



## ljbirns (Mar 16, 2006)

I'm in the same boat. I made the forn. But when you put the required info into the fields and hit submit nothing is e-mailed to me but the info is deleted from the form. Here is my code; ( I am very new at this- yesterday was my first day )

Name

Address

Mailing Address

Telephoe

E-Mail Address

Go back to home page

* Thank You Very Much !

*


----------



## support.clpafs (Apr 7, 2008)

I use PHP-FE (form to email).

http://phpmailer.codeworxtech.com/index.php?pg=sf&p=dl

Setup Level: Moderate


----------



## Mr.LLB (May 27, 2008)

after you guys have created the forms in dreamweaver.....you need a processing script which takes the values in the fields and emails it to the email you provide.....if you want....post your fields here and ill setup the script so it emails you the values


----------



## Mr.LLB (May 27, 2008)

^^ method is incorrect


----------



## ljbirns (Mar 16, 2006)

> FORM METHOD="POST"ACTION="mailto:[email protected]">
> 
> ^^ method is incorrect


OK.
If you please, what is the correct method ? I would appreciate it. I need all the help I can get.

Lew


----------



## Mr.LLB (May 27, 2008)

after you guys have created the forms in dreamweaver.....you need a processing script which takes the values in the fields and emails it to the email you provide.....if you want....post your fields here and ill setup the script so it emails you the values


----------



## ljbirns (Mar 16, 2006)

Name

Address

Mailing Address

Telephoe

E-Mail Address

Go back to home page

* Thank You Very Much !

*


----------



## MRdNk (Apr 7, 2007)

Does your web host allow PHP?

As Mr.LLB has noted you need a processing script, the HTML you've provided only displays a form and doesn't actually process the data.

The HTML form is incorrect as the *ACTION="mailto:[email protected]"* should send the data to a processing page, i.e. process_email.php - this php would then process the form data and send it to your email address.

Or even better just have the actual form page as a php file, such as this:


```
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ; 
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail( "[email protected]", "Subject: $subject",
  $message, "From: $email" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "
  Email: 
  Subject: 
  Message:

  ";
  }
?>
```
- W3 Schools (http://www.w3schools.com/php/php_mail.asp)

If your web host supports php change the script above to format, or let me know, if your web host supports PHP, I can write something for you, and I'm sure others would be happy to as well, if they get to it before me.


----------



## ljbirns (Mar 16, 2006)

PHP is Ok

I tried modifying my script with yours as below but NG. I can get e-mail via a third party like my mail form but I would prefer not to go that route.

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['visiter_name'] ; 
$subject = $_REQUEST['visiter_address'] ;
$message = $_REQUEST['visiter_mailing address'] ;
$message = $_REQUEST['visiter_telephone'] ;
$message = $_REQUEST['visiter_E-Mail'] ;
mail( "[email protected]", "Subject: $visiter_name",
$message, "From: $email" );

Name

Address

Mailing Address

Telephone

E-Mail Address

Go back to home page

* Thank You Very Much !

*


----------



## MRdNk (Apr 7, 2007)

Don't have a lot of time today, but the things that immediately jump out are that you don't have form tags, you don't close the PHP tag with "?>" and you need to put anything that outputs to the brower with *echo('* and end it with *')*.

If you have quotes inside an echo PHP you need to escape the with a backslash \ so , should be , inside the *echo (' ');*.

I'll take a proper look tomorrow.


----------



## MRdNk (Apr 7, 2007)

Here you go, this should work perfectly, test it and let me know, I don't have a mail server set-up on my localhost so I can't be 100% sure this works, but it should do - let me know:


```
<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $visitor_name = $_REQUEST['visitor_name'];
  $visitor_address = $_REQUEST['visitor_address'];
  $visitor_mailing_address = $_REQUEST['visitor_mailing_address'];
  $visitor_tel = $_REQUEST['visitor_tel'];
  $email = $_REQUEST['email'] ; 
  $message = 'Name: $visitor_name, Visitor Address: $visitor_address, Mailing Address: $visitor_mailing_address, Tel: $visitor_tel' ;
  mail( "[email protected]", "Subject: Feedback Form: $visitor_name", $message, "From: $email" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "
  Name: 
  Address: 
  Mailing Address 
  Telephone No. 
  Email: 
  [URL=index.html]Go back to home page[/URL]

  ";
  }
?>
```
Note that your REQUESTs were for visiter, and the form names are visitor (the correct spelling).

P.s. It's easier to read the code, if you use the PHP tags in this forums, which is on the post message tool bar.


----------



## ljbirns (Mar 16, 2006)

I tried it, using my e-mail address, of course. When I hit SUBMIT nothing happens.
This is on my computer not an actual website ( I won't have the actual site for a week or so )
But on my computer if I use My Mail Form.com the e-mail does go through.
I attach a screenshot of the PHP form image. Some funny stuff at the end.
Please don't go crazy over this. I would love it to work, but if it won't I can live with it.
I don't want to take up too much of your time. You have been more than helpful, and I appreciate it.

Lew.


----------



## Dano2 (Nov 30, 1999)

Hi, this is Dano who originally posted this question...sorry I have been away for a few days...sounds like what I need to do 1st is find out if the hosting Company I am using supports PHP? would that be correct? and if they don't what else should I do or find out? thanks...Dano


----------



## ljbirns (Mar 16, 2006)

Hi Dano

I got into your thread because I had the same problem. MRdNk has been real helpful
and I now know that that PHP seems the way to go. I was using Mailto:
which I guess went out 3 or 4 yrs ago.

Lew


----------



## Dano2 (Nov 30, 1999)

Hey Lew...yes he has been really helpful it looks like. I have been gone for a few days due to a car accident but am back online.
So do you know, I think what I need to find out is if the hosting Co I am using supports PHP would that be right? I am in the process right now of trying to find that out....
So were you able to get your form to work? .....thanks, Dano


----------



## MRdNk (Apr 7, 2007)

Yeah find that out first - most do, and therefore you should be OK, but find this out first and then we can sort it out for you. If alternatives are needed then either I'll be able to help or someone else will be able to.

ljbirns can you start a new topic please. Apologies I wasn't following the original poster name. It's bad netiquette to post in another person's thread with your own issue.


----------



## MRdNk (Apr 7, 2007)

Dano2 said:


> Hey Lew...yes he has been really helpful it looks like. I have been gone for a few days due to a car accident but am back online.
> So do you know, I think what I need to find out is if the hosting Co I am using supports PHP would that be right? I am in the process right now of trying to find that out....
> So were you able to get your form to work? .....thanks, Dano


Dano,
If you give me the name of the hosting company or your website name I should be able to find out whether they support PHP or not.


----------



## Dano2 (Nov 30, 1999)

I am using 1&1.com for my hosting. I guess the other thing I need to know is if they support Dreamweaver....never thought about it...


----------



## MRdNk (Apr 7, 2007)

Great, the provider I'm looking to go with. Do you have the Linux or the Microsoft option, and which package do you have?

P.s. No need to support Dreamweaver, as this is only a web design package not a language.


----------



## Dano2 (Nov 30, 1999)

I already have an account there, its the beginner package. I guess I'm still kinda new at this...I already have the beginner package and have a website that I put up on it that I created from scratch (not using Dreamweaver). 
Which raises another question. If I can just use that account for another website there or if I need to purchase another package each time I create a new website do you know? thanks again...dano
Oh and I guess I'm kinda confused as to the Linux versus Windows...I use Windows on my machine...so does that make any difference? thanks....dano


----------



## MRdNk (Apr 7, 2007)

NB. All my comments relate to the UK 1and1 hosting solutions, if you're not in the UK different rules / account terms may apply. 

No worries, go to the 1&1 website, you'll see that there are two options for web hosting solutions either Linux (which includes PHP - although unfortunately not under the 1&1 Beginner package) - UK Version; and "MS Hosting" which uses the Microsoft version ASP.Net. 

If you're on the MS Hosting package, unfortunately, I won't be able to help further as this isn't my area, but you should be able to find someone else to help you. 

As for your second question, you can host more than one website under the same account, some of the more advanced packages give you additional .co.uk etc. and I have put the question to them as to whether these all need to point to the same address the answer was that you can have various websites. - although I strongly suggest you pose the question directly to them yourself, for clarification.

P.s. I am not a hugely experienced web developer, and have spent my time learning php rather than alternatives. There may be a non-php solution that will allow you to create a good enough feedback form.


----------



## Dano2 (Nov 30, 1999)

I finally figured it out...I have the linux package so I have PHP capabilities. I have not created my form as of yet with Dreamweaver but wanted to find out ahead of time what I need to do. 

Do you happen to know the answer to this, I think you said you use 1&1.com? I already have an existing domain/website setup with my 1&1 account.

1: Can I add another website domain to this?
2: How do I do this? I looked at their FAQ's but it was kinda confusing
3: Do I have to pay extra for this?

thanks again in advance...


----------



## MRdNk (Apr 7, 2007)

I've been looking at 1and1, but I haven't purchased from them yet.

As I said... "you can host more than one website under the same account, some of the more advanced packages give you additional .co.uk etc. and I have put the question to them as to whether these all need to point to the same address the answer was that you can have various websites. - although I strongly suggest you pose the question directly to them yourself, for clarification."

As noted on the 1and1, Hosting page, 1and1 Beginner - doesn't support PHP and MySQL, anything above that 1and1Home to Professional supports PHP, and anything from 1and1 Business to Professional supports MySQL.

1and1 Home to Professional also "include .co.uk, .org.uk or .me.uk Domains", and amount of these depends on which package you have, 1and1 Home has 1 of the above included - this is all on the Linux Hosting page.

As I say the best thing is to email them specifically asking.


----------



## Dano2 (Nov 30, 1999)

I hear you and agree I will email their support and check it out....I'm a little ways off from creating a contact page but when I'm finished with it...I will come back here and see about getting my form to work...thanks for all your help...Dano


----------



## kenneth2k1 (Oct 9, 2003)

Hi all:

What if I wanted the code to use an external smtp server to send the form instead of the default mail client on the local workstation? For example, someone goes on there to fill in the form, when they hit submit, it won't open an e-mail client, it would use a specified smtp server to send it so the customer doesn't have to worry if they don't have a mail client set up.

Does that make sense? Thanks!!


----------

