Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

i want to display captcha image but its not working

images php coding issues or problems here.

Moderators: macek, egami, gesf

i want to display captcha image but its not working

Postby yasirzeb » Tue Jul 03, 2012 11:41 pm

<?php
require_once("connection.php");
if(isset($_POST['submit']))
{
$name =$_POST['name'];
$eamil =$_POST['email'];
$code = $_POST['6_letters_code'];
$sql = "INSERT INTO `form` VALUES ('$name','$eamil','code')";
mysql_query($sql);

if(empty($_SESSION['6_letters_code'] ) ||
strcasecmp($_SESSION['6_letters_code'], $_POST['6_letters_code']) != 0)
{
//Note: the captcha code is compared case insensitively.
//if you want case sensitive match, update the check above to
// strcmp()
$errors .= "\n The captcha code does not match!";
}
if(empty($errors))
{
//send the email
$to = $your_email;
$subject="New form submission";
$from = $your_email;
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$body = "A user $name submitted the contact form:\n".
"Name: $name\n".
"Email: $visitor_email \n".
"Message: \n ".
"$user_message\n".
"IP: $ip\n";
$headers = "From: $from \r\n";
$headers .= "Reply-To: $visitor_email \r\n";
mail($to, $subject, $body,$headers);

}
}

?>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
<table width="500" align="center">
<tr>
<td width="201">Name</td>
<td width="287"><input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" id="email" /></td>
</tr>
<tr>
<td>Captcha</td>
<img src="captcha.php"/>
<td><input type="text" name="6_letters_code" id="6_letters_code" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit" id="submit" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
:help: :help: :help: :help: :help: :help:
yasirzeb
New php-forum User
New php-forum User
 
Posts: 6
Joined: Thu Jun 21, 2012 3:18 am

Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron