登录 | 注册 | FAQ
Anonymous

how to make a simple php contact form?

+ 发表回复

4 篇帖子 分页: 1 / 1


how to make a simple php contact form?

freelancerboy » 周三 4月 01, 2015 3:40 pm

I am new in php.
anybody can help me, how can i make php contact form?
头像

freelancerboy

  • 帖子: 3
  • 注册: 周三 4月 01, 2015 3:33 pm
  • 地址: Bangladesh

Re: how to make a simple php contact form?

Chikwado » 周三 4月 01, 2015 9:45 pm

Have you try to read from any tutorials? If yes, then what have you understand so far? If no, then you can try your hands on tutorials. Your question should have be: How to process a form using php? You can read from here: http://www.html.net/tutorials/php/lesson11.php

最后由 Chikwado 编辑于 周四 4月 02, 2015 2:03 pm,总共编辑了 1 次

头像

Chikwado

  • 帖子: 87
  • 注册: 周一 7月 29, 2013 11:36 pm
  • 地址: Nigeria
--
Focus On Advance Science And Programming.

Re: how to make a simple php contact form?

freelancerboy » 周四 4月 02, 2015 9:06 am

Chikwado 写道:Have you try to read from any tutorials? If yes, then what have you understand so far? If no, then you can try your hands on tutorials. Your question should have be "How to process a form using php?" You can read from here: http://www.html.net/tutorials/php/lesson11.php

thanks for good suggestions.
头像

freelancerboy

  • 帖子: 3
  • 注册: 周三 4月 01, 2015 3:33 pm
  • 地址: Bangladesh

Re: how to make a simple php contact form?

Veeramanikandan » 周二 5月 05, 2015 12:55 pm

<?php
if ($_POST["email"]<>'') {
$ToEmail = 'youremail@site.com';
$EmailSubject = 'Site contact form';
$mailheader = "From: ".$_POST["email"]."\r\n";
$mailheader .= "Reply-To: ".$_POST["email"]."\r\n";
$mailheader .= "Content-type: text/html; charset=iso-8859-1\r\n";
$MESSAGE_BODY = "Name: ".$_POST["name"]."";
$MESSAGE_BODY .= "Email: ".$_POST["email"]."";
$MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])."";
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure");
?>
<?php
session_start();
$text = rand(10000,99999);
$_SESSION["vercode"] = $text;
$height = 25;
$width = 65;

$image_p = imagecreate($width, $height);
$black = imagecolorallocate($image_p, 0, 0, 0);
$white = imagecolorallocate($image_p, 255, 255, 255);
$font_size = 14;

imagestring($image_p, $font_size, 5, 5, $text, $white);
imagejpeg($image_p, null, 80);
?>
Your message was sent
<?php
} else {
?>
<form action="test.php" method="post">
<table width="400" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="29%" class="bodytext">Your name:</td>
<td width="71%"><input name="name" type="text" id="name" size="32"></td>
</tr>
<tr>
<td class="bodytext">Email address:</td>
<td><input name="email" type="text" id="email" size="32"></td>
</tr>
<tr>
<td class="bodytext">Comment:</td>
<td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td>
</tr>
<tr>
<td class="bodytext"> </td>
<td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>
</tr>
</table>
</form>
<?php
};
?>
<form action="submit.php" method="post">
Comment: <textarea name="coment"></textarea>
Enter Code <img src="captcha.php"><input type="text" name="vercode" />
<input type="submit" name="Submit" value="Submit" />
</form>
头像

Veeramanikandan

  • 帖子: 20
  • 注册: 周一 9月 22, 2014 4:03 pm


+ 发表回复

分页: 1 / 1