PDA

View Full Version : pls help am new to php contact form


AyPumpin
01-26-2011, 11:39 PM
<?php
$to = "abiolah_remi@yahoo.com";
$subject = "Contact Us";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$website =$_REQUEST['website'];
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
Design by http://www.bluewebtemplates.com
Released for free under a Creative Commons Attribution 3.0 License
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Remtech Concept | Contact Us</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/style.css" rel="stylesheet" type="text/css" />
<!-- CuFon: Enables smooth pretty custom font rendering. 100% SEO friendly. To disable, remove this section -->
<script type="text/javascript" src="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/js/cufon-yui.js"></script>
<script type="text/javascript" src="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/js/arial.js"></script>
<script type="text/javascript" src="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/js/cuf_run.js"></script>
<!-- CuFon ends -->
</head>
<body>
<div class="main">

<div class="header">
<div class="header_resize">
<div class="logo">
<h1><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/index.html"><img src="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/images/logo2.jpg" alt="" name="logo" width="300" height="78" align="top" id="logo" /><small>be inspired</small></a></h1></div>
<div class="nav_menu">
<ul>
<li><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/index.php">Gallery</a></li>
<li><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/bio.php">My BIO</a></li>
<li><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/Folio.php">Folio</a></li>
<li><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/quotes.php">QUotes</a></li>
<li class="active"><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/contact.php">Contacts</a></li>
</ul>
</div>
<div class="clr"></div>
</div>
</div>

<div class="hbg">
<div class="hbg_resize">
<img src="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/images/contact us.jpg" width="391" height="258" alt="pix" class="hbgimg" />
<h2>MY CONTACT PAGE !</h2>
<p>At Remtech Concept we are committed to providing you with experience and quality service in order to move you ahead. Kindly fill the form below and one of our representatives will respond within 24 hours.</p>
<p>Address:Capital building,Maryland ikeja lagos</p>
<p>Telephone: +2348020949600<br />
E-mail: mail@remtechconcepts.com</p>
</div>
</div>

<div class="content">
<div class="content_resize">
<div class="mainbar">
<div class="article"></div>
<div class="article">
<h2>Contact Form</h2><form action="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/Scripts/FormToEmail.php" method="post" name="Contact Form" target="_self"></form>
<form action="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/reply.txt" method="post" target="_self" id="sendemail">
<ol><li>
<label for="name">Name (required)</label>
<input id="name" name="name" class="text" />
</li><li>
<label for="email">Email Address (required)</label>
<input id="email" name="email" class="text" />
</li><li>
<label for="website">Website</label>
<input id="website" name="website" class="text" />
</li><li>
<label for="message">Your Message</label>
<textarea id="message" name="message" rows="8" cols="50"></textarea>
</li><li>
<input type="image" name="imageField" id="imageField" src="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/images/submit.gif" class="send" />
<div class="clr"></div>
</li></ol>
</form>
</div>
</div>
<div class="sidebar">
<div class="gadget">
<h2>AyPumpin</h2>
<img src="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/images/yo.jpg" width="58" height="58" alt="pix" class="imgwh" />''Nothing more beautiful than knowing you're worth<br />
And finally, I know exactly what I deserve''<br />
</div>
<div class="gadget">
<h2>We are Social Folks!</h2>
<ul class="sb_menu">
<li><img src="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/images/facebook.jpg" alt="" name="facebook" width="41" height="43" border="0" usemap="#facebookMap" id="facebook" />
<map name="facebookMap" id="facebookMap">
<area shape="rect" coords="6,6,38,41" href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/facebook.com/akinyeleh" />
</map>
•share with us</li>
<li> <img src="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/images/twitter.jpg" alt="" name="twitter" width="41" height="43" border="0" usemap="#twitterMap" id="twitter" />
<map name="twitterMap" id="twitterMap">
<area shape="rect" coords="4,1,8,6" href="#" />
<area shape="rect" coords="6,7,37,38" href="http://twitter.com/ AyRemiPumpin " />
</map>
• follow me</li>
</ul>
</div>
<div class="gadget">
<h2>&nbsp;</h2>
</div>
</div>
<div class="clr"></div>
</div>
</div>

<div class="fbg"></div>

<div class="footer">
<div class="footer_resize">
<p class="lf">&copy; Copyright RemtechConcepts<a href="http://www.bluewebtemplates.com"></a></p>
<ul class="fmenu">
<li><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/index.php">Gallery</a></li>
<li><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/bio.php">My Bio</a></li>
<li><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/Folio.php">Folio</a></li>
<li><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/quotes.php">Quotes</a></li>
<li class="active"><a href="file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/contact.php">Contacts</a></li>
</ul>
</div>
<div class="clr"></div>
</div>
</div>
</body>
</html>

davidj
01-27-2011, 02:45 PM
first file addressing is wrong. It should be referenced through http.

replace all instances of...

file:///C|/wamp/www/phpcodes/php_sandbox/Remtech ConceptsPHP/index.phpwith

http://www.domain.com/path/Remtech_ConceptsPHP/index.phpwhere the bolded file name should be replaced with your relevant one.

The reason why your form isn't posting is that your action value is referenced as above.

Also. you should not use $_REQUEST as this is ambiguous and could be a security hole. Your form method is set to post then you should $_POST

You should clean all your posted data before sending out

More...

You are outputting error messages before the HTML. This makes the HTML invalid and you don't have any control where your messages are output.

Store the messages in a variable and output in the <body> of the HTML