 |
08-13-2009, 08:02 AM
|
Contact Us Form
|
Posts: 43
|
Hi Everyone!
As a newbie to html I am having dificulties setting up my contact us form in html/php
The form does nothing I have seen some videos on youtube but I'm still finding it hard to do it.
Is there anyone out there that can help for a little cash incentive?
The site is telg-solutions-ltd.co.uk
|
|
|
|
08-13-2009, 09:08 AM
|
Re: Contact Us Form
|
Posts: 18
Name: Alex S. K.
Location: Bishkek, KG
|
Hello, elcrazyman! What this form must do: save data to the file or send it to admin by mail (If second, how it must send: with help of sendmail`s function or it must
connect to SMTP?)
|
|
|
|
08-13-2009, 10:23 AM
|
Re: Contact Us Form
|
Posts: 18
Name: Alex S. K.
Location: Bishkek, KG
|
HTML Form
HTML Code:
<div align="center">
<form action="http://localhost/mytest/send.php" method="post">
<font color="#CE3200"><b>Contact us</b></font>
<br />
Name<font color="#CE3200">*</font>:
<input type="text" name="name" size="35" maxlength="25" value="" />
<br />
Your E-mail<font color="#CE3200">*</font>:
<input type="text" name="email" size="35" maxlength="25" value="" />
<br />
Subject<font color="#CE3200">*</font>:
<input type="text" name="subject" size="35" maxlength="25" value="" />
<br />
Message<font color="#CE3200">*</font>:
<br />
<textarea name="message" rows="5" cols="35"></textarea>
<br />
Security code<font color="#CE3200">*</font>:
<img src="secure.php" alt="Security code" />
<input type="text" name="code" size="5" maxlength="5" value="" />
<br />
<input type="submit" value="Send message!" />
</form>
</div>
send.php
PHP Code:
<?
session_start();
//======================================================
$tomail = 'admin@domin.com';
//All mails will send to this e-mail!
$success_page = 'http://localhost/mytest/success.html';
//If there are NO mistakes in the field, user will redirect to this page
$error_page = 'http://localhost/mytest/fail.html';
//If there are mistakes in the field, user will redirect to this page
$name_len = '2';
//Min size of the name: if 0, name`s field will optional
$subject_len = '3';
//Min size of the subject: if 0, subject`s field will optional
$message_len = '5';
//Min size of the message: if 0, message`s field will optional
//======================================================
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$code = $_POST['code'];
$error = '0';
$rcode = $_SESSION['t1'].$_SESSION['t2'].$_SESSION['t3'].$_SESSION['t4'].$_SESSION['t5'];
if(!$code == $rcode) {
$error++;
}
if(strlen($name)<$name_len) {
$error++;
}
if(strlen($subject)<$subject_len) {
$error++;
}
if(strlen($message)<$message_len) {
$error++;
}
if(!preg_match("/^[-0-9a-z_\.]+@[-0-9a-z_^\.]+\.(?:com|edu|gov|int|mil|net|org|biz|pro|info|museum|coop|name|aero|[a-z][a-z])$/i", $email)) {
$error++;
}
if($error>0) {
header("location: $error_page");
} else {
@mail("$tomail","$subject","$message","From: $email") or die("Sorry, but happened an error!");
header("location: $success_page");
}
?>
secure.php
PHP Code:
<?
session_start();
$img='security.gif'; //Root of the security background
$font = 'font.ttf'; //Root of the font
$img=ImageCreateFromGif($img);
$_SESSION['t1'] = rand(0, 9);
$textbg = ImageColorAllocateAlpha($img,rand(50,170),rand(50,170),rand(50,170),0);
$ox = 0+rand(-1,1);
$oy = 17+rand(-1,1);
$size = 15+rand(-1,1);
$angle = rand(-10,10);
imagettftext($img,$size,$angle,$ox,$oy,$textbg,$font,$_SESSION['t1']);
$_SESSION['t2'] = rand(0, 9);
$textbg = ImageColorAllocateAlpha($img,rand(50,170),rand(50,170),rand(50,170),0);
$ox = 11+rand(-1,1);
$oy = 17+rand(-1,1);
$size = 15+rand(-1,1);
$angle = rand(-10,10);
imagettftext($img,$size,$angle,$ox,$oy,$textbg,$font,$_SESSION['t2']);
$_SESSION['t3'] = rand(0, 9);
$textbg = ImageColorAllocateAlpha($img,rand(50,170),rand(50,170),rand(50,170),0);
$ox = 23+rand(-1,1);
$oy = 17+rand(-1,1);
$size = 15+rand(-1,1);
$angle = rand(-10,10);
imagettftext($img,$size,$angle,$ox,$oy,$textbg,$font,$_SESSION['t3']);
$_SESSION['t4'] = rand(0, 9);
$textbg = ImageColorAllocateAlpha($img,rand(50,170),rand(50,170),rand(50,170),0);
$ox = 33+rand(-1,1);
$oy = 17+rand(-1,1);
$size = 15+rand(-1,1);
$angle = rand(-10,10);
imagettftext($img,$size,$angle,$ox,$oy,$textbg,$font,$_SESSION['t4']);
$_SESSION['t5'] = rand(0, 9);
$textbg = ImageColorAllocateAlpha($img,rand(50,170),rand(50,170),rand(50,170),0);
$ox = 43+rand(-1,1);
$oy = 17+rand(-1,1);
$size = 15+rand(-1,1);
$angle = rand(-10,10);
imagettftext($img,$size,$angle,$ox,$oy,$textbg,$font,$_SESSION['t5']);
header('Content-type: image/gif');
imagegif($img);
?>
And you must unzip and place files (in attachment) in the directory where you will using this script. Don`t forget configure files of the script.
|
|
|
|
08-14-2009, 03:45 PM
|
Re: Contact Us Form
|
Posts: 43
|
Hi There,
Thanks for your reply, I did give it a try and I couldn't figure it out I personally think my knoledge on html is crap! I'm very new to this!
I will give it another shot!
Again thanks
|
|
|
|
09-03-2009, 02:36 AM
|
Re: Contact Us Form
|
Posts: 6
Name: Upendra Duwadi
|
Hello there,
If you have webform uploaded in the web then please give me the address, subject of your mail, and email address to send the form then I will create you full script that you do not need to edit even a line. All that is free of cost friend.
|
|
|
|
09-03-2009, 04:56 PM
|
Re: Contact Us Form
|
Posts: 280
Name: Randy
Location: Northern Wisconsin
|
|
|
|
|
09-04-2009, 11:11 AM
|
Re: Contact Us Form
|
Posts: 7
Name: ajju
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Email Form </title>
</head>
<body>
<form method="post" action="sendeail.php">
<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
Your Name: <br />
<input type="text" name="visitor" size="35" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="35" />
<br /> <br />
<br />
Attention:<br />
<select name="attn" size="1">
<option value=" Sales n Billing ">Sales n Billing </option>
<option value=" General Support ">General Support </option>
<option value=" Technical Support ">Technical Support </option>
<option value=" Webmaster ">Webmaster </option>
</select>
<br /><br />
Mail Message:
<br />
<textarea name="notes" rows="4" cols="40"></textarea>
<br />
<input type="submit" value="Send Mail" />
<br />
</form>
</body>
</html>
|
|
|
|
|
« Reply to Contact Us Form
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|