I need help with a Contact Form!!!!!!!!!!!

Discussion in 'HTML & Website Design' started by medianthem, Jun 13, 2007.

  1. #1
    Hi everyone" I need help configuring a contact from from a template I downloads, where should I add my email address , I've tried a lot of things , but when I click the submit button "outlook Express " opens in my screen, I dont want that , please help me, here is the code anyway. Thanks!

    <form action="">
    <p>
    <label>Nombre</label>
    <input name="dname" type="text" size="35" />
    <label>Email</label>
    <input name="demail" type="text" size="35" />
    <label>Preguntas y comentarios </label>
    <textarea name="textarea" cols="5" rows="5"></textarea>
    <br />
    <input type="submit" class="button" value="." />
    </p>
    </form>
     
    medianthem, Jun 13, 2007 IP
  2. PHPGator

    PHPGator Banned

    Messages:
    4,437
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    260
    #2
    You should use PHP to send the contact us form via email. This would require some additional code from what you have there. I could do it for $10.00 via Paypal.
     
    PHPGator, Jun 13, 2007 IP
  3. webandrey

    webandrey Well-Known Member

    Messages:
    328
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #3
    Yes, PHPGator is right. You should use PHP.
     
    webandrey, Jun 13, 2007 IP
  4. Mike H.

    Mike H. Peon

    Messages:
    219
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    <?php 
    	if (isset($_POST['submit']))
    		{
    		 $to = "me@localhost";  // change this to the recipient's email address
    		 $headers = "From: Site Visitor\n";  
    		 $headers .= "Content-Type: text/plain; charset=iso-8859-1\n";
    		 $subj = "Inquiry";
    		 $details = "Name: ".$_POST['contact']."\n";
    		 $details .= "Email: ".$_POST['email']."\n";
    		 $details .= "Message:\n".$_POST['message'];
    		 mail($to, $subj, $details, $headers);
    		 header("Location: thankyou.html");   // create a thankyou.html page in the same folder
    		 exit;
    		}
    ?>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Inquiry Form</title>
    <script type="text/javascript">
    	
    	function validate(nForm){
    
    		for (i=0; i<3; i++)
    			{if (nForm[i].value == ""){alert('Please complete all fields');return false}}
    	}
    
    </script>
    <style type="text/css">
    
    	form {width:300px;margin:auto;padding-top:30px}
    	fieldset {padding:5px;background-color:#f0fff0;border:1px solid #87ceeb}
    	legend {font-size:14pt;color:#00008b;background-color:#87ceeb;padding-left:3px;padding-right:3px;margin-bottom:5px;}
    	label {font-size:12pt;color:#00008B;padding:5px}
    	.submitBtn {font-family:tahoma;font-size:10pt;display:block;margin-left:auto;margin-right:auto;margin-top:5px;margin-bottom:5px}
    
    </style>
    </head>
    <body>
    	<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" onsubmit="return validate(this)">
    		<fieldset>
    		   <legend>Inquiry</legend>	
    			<label> Name: <input type='text' name='contact' size='30'></label>
    			<br>
    			<label>Email: &nbsp;<input type='text' name='email' size='30'></label>
    			<br>
    			<label>Message:
    			<br>
    			<textarea name='message' rows='4' cols='30' style='overflow:auto;margin-left:12px'></textarea>
    			</label>
    			<input type='submit' name="submit" value="Submit" class="submitBtn">
    		</fieldset>
    	</form>
    </body>
    </html>
    Code (markup):
     
    Mike H., Jun 13, 2007 IP
  5. medianthem

    medianthem Peon

    Messages:
    196
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks a lot Mike H.!!!! That worked!!! And thanks to all of you guys, your posts gave me ideas. ;)
     
    medianthem, Jun 13, 2007 IP
  6. leksa

    leksa Active Member

    Messages:
    432
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #6
    Nice shot mike H :D ..

    thats the power of sharing :D
     
    leksa, Jun 13, 2007 IP