ClioSport.net

Register a free account today to become a member!
Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

  • When you purchase through links on our site, we may earn an affiliate commission. Read more here.

Fellow Web People! How to Make a Contact form?



  306 TD Slut
Hello,

Im trying to make a contact form, creating the fields in dreamweaver is fine. Its just how do i get it to send the information to my email address?

etc.. name, tel # comments etc..

i have had a quick looksie on google and cant seem to find nout.

can anyone shed any light on this for me?

thanks in advance.
 
  172 MKII FF
You need to use some form of scripting language to get the "method" of the form i.e. GET or POST vars. From here you can create a script to email the values e.g:

In Php I would do the following:

$email = $_POST['email'];
$name = $_POST['name'];
$body = "Name: ".$name;
$body.= "Email: ".$email;

mail("bla@bla.com","A subject line",$body,"From: Bla@blas.com");
 
  306 TD Slut
hmm php is something i know nothing about!!

i just followed a guide on w3schools, but it sends the info via email to the recipient using this.
Code:
<form action="[EMAIL="mark.simons@smc-comms.com"]MAILTO:mark.simons@smc-comms.com[/EMAIL]" method="post" enctype="text/plain" name="form1" id="form1">
        Name:<br/>
           <input type="text" name="name" /> 
    <br/>          
          Tel#:<br/>
           <input type="text" name="telephone" />
     <br/>
           Comments:<br/>
           <input type="text" name="comment" size="40"/>
     <br/>
           <input type="submit" name="comment" value="Submit" />
           
       </form>
 
  172 MKII FF
I suppose this was can be used but there is no way of validating the information sent through the form.
 
  306 TD Slut
sexyhorny.com??? lol!

haha cheers fella, i shall look into usding that, but i also, know nothing about asp, will have to research!
 
  Rav4
if you get stuck, just give me a shout.

Yer I had to add something funny.

There are many ways of doing this, hundreds infact, but this is the one I use, it works well, I re-use it all the time, have a go.

:)

All the best.
 
  306 TD Slut
dude.. u could of just sent a pm full of arabic!!! trying to understand what it all means..

i do appreciate tho! im siving through it now! :)
 
  Rav4
did you get this sorted ? Would like to know the outcome and what else you were suggested :)

Thanks,

G.
 
  306 TD Slut
hey matey, unfortunatly i havent got it sorted yet, i think it may be something to do with my hosting sever not being php enabled..

I tried your script and conteos's and another from the net and no luck! :(

going to have to log into the Cpanel and see if i can enable php or give them a ring!
 
  Rav4
the code I give you is ASP not php !! Therefore the extension of the file must be form.asp !!!

do you want me to send you the files to your email so you just upload them on the server and test it out that way?

Think you are a bit confused :rasp:
 

KDF

  Audi TT Stronic
bah... asp..

Use php..

put this into a blank file called info.php

Code:
<? phpinfo(); ?>

and upload it somwhere to your web host.. then type in the URL to the file and if it pops up a page with masses of info you have php installed and ready to use.. it will also tell you what php modules are installed. If you have php I can provide you with a piss easy to understand script to do what you want.
 
  Rav4
lol I totally agree with you but at work ASP is the only language used, and the guy next to me is a excellent with ASP thus using it.

I provided him with all the code, fully working for an ASP contact form page.

lol :rasp: u cheeky sod :clown:

bah... asp..

Use php..

put this into a blank file called info.php

Code:
<? phpinfo(); ?>

and upload it somwhere to your web host.. then type in the URL to the file and if it pops up a page with masses of info you have php installed and ready to use.. it will also tell you what php modules are installed. If you have php I can provide you with a piss easy to understand script to do what you want.
 
  306 TD Slut
i did that and it came up with a file download box..

so i guess its not enabled on there :(
 
Last edited:
  306 TD Slut
i just did it on my personal space, and it looks like php is enabled on there as it came up with all this shizzle here: http://www.marksimons.co.uk/info.php

going to try some of the code given to me and see if it works there.

cheers gabi for the help, appreciate it, i know nothing about asp or php but php looks easier to me so am going to try some of that.
 
  Rav4
lol it is what ever you are more comfy with, they are both completely different but achieve similar outputs.

Let us know how you get on :)

Good luck :)
 

KDF

  Audi TT Stronic
just post the code up and i'll help you out.. a contact form is one of the most common and basic things you can do..


They used to use ASP in my work too.. until I told them I was using PHP and wouldnt help if they used ASP haha.. suckers..
 
  306 TD Slut
lol it is what ever you are more comfy with, they are both completely different but achieve similar outputs.

Let us know how you get on :)

Good luck :)

thanks mate

all working now :)

KDF:

Im looking to make it so you cannot submit the form until all fields are completed. i.e the users email address is a cumpulsory field as is name and telephone number.

heres the code i have so far, which conteo kindly supplied me with.

Code:
//Configuration
    $email_address = "[EMAIL="mark.simons@smc-comms.com"]mark.simons@smc-comms.com[/EMAIL]"; //This should be changed to your email address.
    $subject_prefix = "test Contact Form Subject ";  //This will be the subject prefix of all emails. default "Website Contact - User Subject
// --- Do not modify below ---
//Collects varibles from previous page.
    $name = $_POST['name'];
    $email = $_POST['email'];
    $subject = $subject_prefix . $_POST['subject'];
    $message = $_POST['message'];
//This part should prevent malicous doings.
//Most servers are setup in such a way that this section is not needed but its a good security precaution to have.
   $from = urldecode($email);
   if (eregi("\r",$from) || eregi("\n",$from)){
           print "Malformed Headers were detected.";
        exit;
   }
//This part sends the email to you.
    mail($email_address, $subject, $message, "From: $name <$email>\nX-Mailer: Simple PHP Contact Form 1.0 ([URL="http://www.korske.com"]www.korske.com[/URL])");
//Redirects to sent.htm  
    header("Location: sent.htm")
 
  306 TD Slut
lol yeah i noticed the other day, dont quite line up. I have a new pattern defined in photoshop to make a new bg just havent been arsed to change it.

out of interest, how do you create u diagonal line bg's? in ps by defining a pattern?
 

KDF

  Audi TT Stronic
Code:
// Check for empty data
$error = 0;
if(empty($_POST['name'])) { $error = 1; }
if(empty($_POST['email'])) { $error = 1; }
if(empty($_POST['subject'])) { $error = 1; }
if(empty($_POST['message'])) { $error = 1; }

//Configuration
    $email_address = "mark.simons@smc-comms.com"; //This should be changed to your email address.
    $subject_prefix = "test Contact Form Subject ";  //This will be the subject prefix of all emails. default "Website Contact - User Subject
// --- Do not modify below ---
//Collects varibles from previous page.
    $name = $_POST['name'];
    $email = $_POST['email'];
    $subject = $subject_prefix . $_POST['subject'];
    $message = $_POST['message'];
//This part should prevent malicous doings.
//Most servers are setup in such a way that this section is not needed but its a good security precaution to have.
   $from = urldecode($email);
   if (eregi("\r",$from) || eregi("\n",$from)){
           print "Malformed Headers were detected.";
        exit;
   }
//This part sends the email to you.
    mail($email_address, $subject, $message, "From: $name <$email>\nX-Mailer: Simple PHP Contact Form 1.0 (www.korske.com)");

if($error ==1) 
{
  // Redirect back to contact form
  header("Location: blah.htm");
 } else {
 //Redirects to sent.htm  
  header("Location: sent.htm")
}

Added simple check to see if all fields were filled in, if you were doing it properly you would post the form back on itself, use sessions, do proper checks on each field (not just empty checks) and have the form pull data from the session data on post back.

I wouldnt bother with javascript as users can disable it.. or at the very least back up any javascript checks with server side checks aswell.
 
  20VT Clio & 9-5 HOT
on the interiors site they get very little traffic really so it ok for that :)

I do use server side checking on most of my other sites as well as.

p.s its a live site, so dont send off actual messages or they will be asking me whats going on hehe!

as for diagaonals. 5px x 5px 5 pixels coloured in in a diagonal shape then define as patern.

get a bit tricky if you try and do thicker lines tho
 
  Fiat Panda 100hp
Looking at your portfolio you seem pretty clued up with web design, thought you would have known how to create a contact form. I am complete amature, but its one of the 1st things I wanted to learn.
 
  Rav4
Furry, did not realise you went to pompey uni !!!!!

When did you leave? I must have been there at the same time as you!
 
  306 TD Slut
Looking at your portfolio you seem pretty clued up with web design, thought you would have known how to create a contact form. I am complete amature, but its one of the 1st things I wanted to learn.

They are only pretty basic css sites that i have made so far, i have only been doing it coming upto a year as my job, but that includes doing brochures and other graphic design stuff, i much prefer web design tho, its a shame i dont really get a chance to do my own stuff at work, and the MD had a style that he likes.

I have a couple of sites non work related which are in the pipeline so im hoping to go all out on them and i want to try and learn php too. but havent had much time!!

Gabi. yep, good o'l pompey uni, i did communication design in the eldon building, what course did you do? i graduated 2005.. i think.. or was it 2006..
 

KDF

  Audi TT Stronic
whoops sorry just noticed an error in the script..

it will still send the email even if all fields are not complete..

you want to move the

mail($email_address, $sub...........

line into the

//Redirects to sent.htm

loop so that it only sends an email if there is no error.
 
  306 TD Slut
i wondered why i couldnt get it to work. kept saying error line 52 etc..

ideally id like it to prevent the info from sending and pop up an error box saying fill it in biatch!
 
  20VT Clio & 9-5 HOT
JS it is then! hehe!

just use server side checking as well in case they have JS turned off (which very few people do so cant see it being a problem)
 
  306 TD Slut
unfortunatly i lived at home and didnt live in halls, had its pros and cons.. mainly cons apart from free living and food, but missed out nig time on nightlife.

went to the union a fair few times and crashed in halls tho. had some mental nights!
 
  Rav4
post a pic up, wanna c if I have seen your face around uni !!!

U going to start learning php or asp then?
 


Top