I brought a website template off line. it came with a contact form that i have know idea how to edit it. here is the code please help i just want the message to go straight to my email when the user pushes send.
Thanks in advance i been online for hours trying to get help.
someone said put my email address in the action part of the script but that didn't work.

Everybody php code and form i tried to follow isnt basic like mines. so i get confused. on how to set of the php page for this simply contact form.

1.
      <h2>Contact Form</h2>
   2.
      <div class="wrapper margin-bot">
   3.
      <div class="col-3">
   4.
       
   5.
      <div class<form id="contact-form" action="" method="post" enctype="multipart/form-data">
   6.
      <fieldset>
   7.
      <label><span class="text-form">Name:</span><input name="p1" type="text" /></label>
   8.
      <label><span class="text-form">Email:</span><input name="p2" type="text" /></label>
   9.
      <div class="wrapper"><div class="text-form">Message:</div><textarea></textarea></div>
  10.
      <div class="buttons">
  11.
      <a class="button-2" href="#" onClick="document.getElementById('contact-form').reset()">Clear</a>
  12.
      <a class="button-2" href="#" onClick="document.getElementById('contact-form').submit()">Send</a>
  13.
      </div>
  14.
      </fieldset>
  15.
      </form>
  16.
      </div>

Recommended Answers

All 7 Replies

when the form post's (user hits submit) you need to either make it go to another page or somewhere to make php send you a email this is probley the easiest way but i would say its the best

<?php


if($_POST['something1']){
	$to = "your_email address";
 $subject = "Hi DATA FROM WEBSITE";
 $body = "Hi,\n\n HEY THIS IS DATA FROM WEBSITE \n\n DATA1:".$POST['something1']."\n\nDATA2".$_POST['something2'];
 if (mail($to, $subject, $body)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }
}ELSE{
echo "<form action=\"?\" method=\"post\" target=\"_self\" >
<input name=\"something1\" type=\"text\" />
<input name=\"something2\" type=\"text\" />
<input type=\"submit\" />
</form>";
}
?>

when you click send. get goes to a new page and ask you to submit two query in these two boxes. when i dont the message says sent.


but its sending messages from my server.... my server name is on the email

so you get a email it just has the server name?
you would have to add in the headers so that
you can make it come from what ever email you would like
or you can use smtp auth to do it

and it dose something weird when you push send. after you push send it the
goes to a separate page that say type in query. and i just put anything in the boxes and then when i checked my email it had my serve name attached. weird i just need a simple script that send mail from the website to the my email...


could you show me the php script this is my form code thanks

<h2>Contact Form</h2> 

<div class="wrapper margin-bot">

<div class="col-3">

<div class<form id="contact-form" action="" method="post" enctype="multipart/form-data">

<fieldset>

<label><span class="text-form">Name:</span><input name="p1" type="text" /></label>

<label><span class="text-form">Email:</span><input name="p2" type="text" /></label>

<div class="wrapper"><div class="text-form">Message:</div><textarea></textarea></div>

<div class="buttons">

<a class="button-2" href="#" onClick="document.getElementById('contact-form').reset()">Clear</a>

<a class="button-2" href="#" onClick="document.getElementById('contact-form').submit()">Send</a>

</div>

</fieldset>



</form>

</div>

your code by the looks of it is not using php it looks like it has a javascript function take a look at his

onClick="document.getElementById('contact-form').reset()

some where either at the top of your page or include you will have something with that name would you want to attach it so we can try to figure it out

your code by the looks of it is not using php it looks like it has a javascript function take a look at his

onClick="document.getElementById('contact-form').reset()

some where either at the top of your page or include you will have something with that name would you want to attach it so we can try to figure it out

i didnt see any java script link...this is everything in the header the template didt com with a include folder or script.

<!DOCTYPE html>
<html lang="en">
	<head>
		<title>Algie Jenkins Homepage</title>
		<meta charset="utf-8">
		<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
		<link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
		<link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="all">
		<link rel="stylesheet" href="css/style.css" type="text/css" media="all">
		<script type="text/javascript" src="js/jquery-1.6.js" ></script>
		<script type="text/javascript" src="js/cufon-yui.js"></script>
		<script type="text/javascript" src="js/cufon-replace.js"></script>
  		<script type="text/javascript" src="js/Ubuntu_400.font.js"></script>
  		<script type="text/javascript" src="js/Ubuntu_700.font.js"></script>
		<script type="text/javascript" src="js/bgSlider.js" ></script>
		<script type="text/javascript" src="js/script.js" ></script>
		<script type="text/javascript" src="js/pages.js"></script>
		<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
		<script type="text/javascript" src="js/bg.js" ></script>
		<script type="text/javascript" src="js/tabs.js"></script>
		<script type="text/javascript" src="js/jquery.prettyPhoto.js"></script>
		<!--[if lt IE 9]>
			<script type="text/javascript" src="js/html5.js"></script>
		<![endif]-->
		<!--[if lt IE 7]>
			<div style='clear:both;text-align:center;position:relative'>
				<a href="http://www.microsoft.com/windows/internet-explorer/default.aspx?ocid=ie6_countdown_bannercode"><img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0"  alt="" /></a>
			</div>
		<![endif]-->
    <style type="text/css">
<!--
.contentwords {	font-family: "Century Gothic";
	color: #FFF;
}
.contentwords1 {	font-family: "Century Gothic";
	color: #FFF;
	text-align: center;
	font-size: 14px;
}
a:visited {
	color: #666;
}
a:hover {
	color: #999;
}
a:active {
	color: #666;
}
-->
    </style>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<body id="page1">
		<div class="spinner"></div>
		<div id="bgSlider"></div>
		<div class="extra">
			<div class="main">
				<div class="box">
<!-- header -->

i mean i dont see any java related to the contact form...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.