CAPTCHA on contact page using php

0
August 16, 2011

I am trying to get add "CAPTCHA" to a already existing php contact page. I found this

http://www.encaps.net/soft ware/php-c aptcha/

but when i put it on my page it sent an email without adding anything to the box.

Is this because i am calling another php page that is sending the email?

I am not good with php at all. Can someone look at this and let me know what i did wrong? I left the captcha.php page the same as the page suggested.

<?php sessionstart() ?>
<form enctype="multipart/form-data" action="diprocess.php" method="post">
<table width="50%" border="0">
<tbody>
<tr><td> Name<span class="red">*</span></td>
<td>
<input type="text" name="Name" size="25" /></td></tr>
<tr><td> Phone<span class="red"></span></td>
<td>
<input type="text" name="Phone" size="25" /></td></tr>
<tr><td> Email</td>
<td>
<input type="email" name="Email" size="25" /></td></tr>
<tr><td> Message<span class="red"></span></td>
<td>
<textarea name="Message" rows="10" cols="25"></textarea></td></tr>
<tr><td><img src="captcha.php" alt="captcha image"></td><td><input type="text" name="captcha" size="3" maxlength="3"></td></tr>
</tbody>
</table>
<input type="submit" value="Submit Form" />   <input type="reset" value="Clear Form" /></form>
<?php
if(isset($POST["captcha"]))
if($SESSION["captcha"]==$POST["captcha"])
{
    //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...echo 'CAPTHCA is valid; proceed the message';
}
else
{echo 'CAPTHCA is not valid; ignore submission';
}
?>

21

answers

Comments See all(0)

Add comment
0
August 16, 2011

Yes, that was for debugging.  I removed it in this code:

<?php
session_start();
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','BusinessName');
pt_register('POST','BusinessType');
pt_register('POST','Phone');
pt_register('POST','Email');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($Name=="" || $Phone=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($_SESSION["captcha"] == $_POST["captcha"]) {
    //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
} else {$error.="<li>Invalid captcha.";$errors=1;
}
if ($errors == 0) {
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Business Name: ".$BusinessName."
Business Type: ".$BusinessType."
Phone: ".$Phone."
Email: ".$Email."
Message: ".$Message."
";
$message = stripslashes($message);
mail("test@test.com","Distributor Inquiry - test.com",$message,"From: $Email");
}
?>

<?php 
if($errors==1) {
echo $error;
} else {
?>
<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<p>Your message has been sent. Below is a copy of your message. <br>
<a href="index.php">Click here to go back</a> </p>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Business Name: </td><td> <?php echo $BusinessName; ?> </td></tr>
<tr><td>Business Type: </td><td> <?php echo $BusinessType; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
<tr><td>Message: </td><td> <?php echo $Message; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->

<?php 
}
?>
0
August 16, 2011

Yes, you must submit the page to the page that does the captcha processing.  Once the captcha is validated, then send the email.  Let me see your diprocess.php and I'll try adding it for you.

0
August 16, 2011

here is the diprocess.php file

<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','BusinessName');
pt_register('POST','BusinessType');
pt_register('POST','Phone');
pt_register('POST','Email');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($Name=="" || $Phone=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Business Name: ".$BusinessName."
Business Type: ".$BusinessType."
Phone: ".$Phone."
Email: ".$Email."
Message: ".$Message."
";
$message = stripslashes($message);
mail("test@test.com","Distributor Inquiry - test.com",$message,"From: $Email");
?>


<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<p>Your message has been sent. Below is a copy of your message. <br>
<a href="index.php">Click here to go back</a> </p>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Business Name: </td><td> <?php echo $BusinessName; ?> </td></tr>
<tr><td>Business Type: </td><td> <?php echo $BusinessType; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
<tr><td>Message: </td><td> <?php echo $Message; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->

<?php 
}
?>
0
August 16, 2011

This should work for you.  You may also delete it from your form page.

<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','BusinessName');
pt_register('POST','BusinessType');
pt_register('POST','Phone');
pt_register('POST','Email');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($Name=="" || $Phone=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if(isset($_POST["captcha"]))
if($_SESSION["captcha"]==$_POST["captcha"])
{
    //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
}
else
{$error.="<li>Invalid email address entered";$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Business Name: ".$BusinessName."
Business Type: ".$BusinessType."
Phone: ".$Phone."
Email: ".$Email."
Message: ".$Message."
";
$message = stripslashes($message);
mail("test@test.com","Distributor Inquiry - test.com",$message,"From: $Email");
?>


<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<p>Your message has been sent. Below is a copy of your message. <br>
<a href="index.php">Click here to go back</a> </p>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Business Name: </td><td> <?php echo $BusinessName; ?> </td></tr>
<tr><td>Business Type: </td><td> <?php echo $BusinessType; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
<tr><td>Message: </td><td> <?php echo $Message; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->

<?php 
}
?>
0
August 16, 2011

Note:  I forgot to change the error, so I changed it here this time to "Invalid captcha."  You can change this on line 26.

<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','BusinessName');
pt_register('POST','BusinessType');
pt_register('POST','Phone');
pt_register('POST','Email');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($Name=="" || $Phone=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if(isset($_POST["captcha"]))
if($_SESSION["captcha"]==$_POST["captcha"])
{
    //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
}
else
{$error.="<li>Invalid captcha.";$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Business Name: ".$BusinessName."
Business Type: ".$BusinessType."
Phone: ".$Phone."
Email: ".$Email."
Message: ".$Message."
";
$message = stripslashes($message);
mail("test@test.com","Distributor Inquiry - test.com",$message,"From: $Email");
?>


<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<p>Your message has been sent. Below is a copy of your message. <br>
<a href="index.php">Click here to go back</a> </p>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Business Name: </td><td> <?php echo $BusinessName; ?> </td></tr>
<tr><td>Business Type: </td><td> <?php echo $BusinessType; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
<tr><td>Message: </td><td> <?php echo $Message; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->

<?php 
}
?>
0
August 16, 2011

Do i remove all 3 from the form page. If not, which 1's?

       <?php session_start() ?>

       <tr><td><img src="captcha.php" alt="captcha image"></td><td><input type="text" name="captcha" size="3" maxlength="3"></td></tr>

      <?php

if(isset($_POST["captcha"]

))

if($_SESSION["captcha"]==$

_POST["cap

tcha"])

{

    //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...

      echo 'CAPTHCA is valid; proceed the message';

}

else

{

      echo 'CAPTHCA is not valid; ignore submission';

}

?>

0
August 16, 2011

From your code, just use this:

1.        <?php session_start() ?>
2.        <tr><td><img src="captcha.php" alt="captcha image"></td><td><input type="text" name="captcha" size="3" maxlength="3"></td></tr>
?>

Also, since you're using sessions, you'll need to add session_start() to the other page, too.  (Attached.)

<?php
session_start()
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','BusinessName');
pt_register('POST','BusinessType');
pt_register('POST','Phone');
pt_register('POST','Email');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($Name=="" || $Phone=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if(isset($_POST["captcha"]))
if($_SESSION["captcha"]==$_POST["captcha"])
{
    //CAPTHCA is valid; proceed the message: save to database, send by e-mail ...
}
else
{$error.="<li>Invalid captcha.";$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Business Name: ".$BusinessName."
Business Type: ".$BusinessType."
Phone: ".$Phone."
Email: ".$Email."
Message: ".$Message."
";
$message = stripslashes($message);
mail("test@test.com","Distributor Inquiry - test.com",$message,"From: $Email");
?>


<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<p>Your message has been sent. Below is a copy of your message. <br>
<a href="index.php">Click here to go back</a> </p>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Business Name: </td><td> <?php echo $BusinessName; ?> </td></tr>
<tr><td>Business Type: </td><td> <?php echo $BusinessType; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
<tr><td>Message: </td><td> <?php echo $Message; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->

<?php 
}
?>
0
August 16, 2011

I just gave it a try with the following issues.

If i leave the captcha blank, it sends the email.

If i type in the correct captcha, it says invalid email.

The only thing i changed beside the correct email address was this:

<img src="captcha.php" alt="captcha image"></td><td><input type="text" name="captcha" size="3" maxlength="3">

0
August 16, 2011

nevermind think i might have it.. give you an update in a sec.

0
August 16, 2011

nope. same issue. I went back to 3 for the inputs size and maxlength since i was only suppose to be typing the black letters. Do you think it could be something wrong with the captcha.php file itself. I downloaded the one that was provided by the website with no changes to it.

0
August 16, 2011

No, there's probably just a small bug we'll have to work out quickly.  I changed somethings around which should help us.  Try.

<?php
session_start()
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','BusinessName');
pt_register('POST','BusinessType');
pt_register('POST','Phone');
pt_register('POST','Email');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($Name=="" || $Phone=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($_SESSION["captcha"]==$_POST["captcha"])
{
    var_dump($_SESSION["captcha"];
    var_dump($_POST["captcha"];
}
else
{$error.="<li>Invalid captcha.";$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Business Name: ".$BusinessName."
Business Type: ".$BusinessType."
Phone: ".$Phone."
Email: ".$Email."
Message: ".$Message."
";
$message = stripslashes($message);
mail("test@test.com","Distributor Inquiry - test.com",$message,"From: $Email");
?>


<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<p>Your message has been sent. Below is a copy of your message. <br>
<a href="index.php">Click here to go back</a> </p>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Business Name: </td><td> <?php echo $BusinessName; ?> </td></tr>
<tr><td>Business Type: </td><td> <?php echo $BusinessType; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
<tr><td>Message: </td><td> <?php echo $Message; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->

<?php 
}
?>
0
August 16, 2011

The website cannot display the page

 HTTP 500  

   Most likely causes:

?The website is under maintenance.

?The website has a programming error.

0
August 16, 2011

Fixed, sorry.

<?php
session_start()
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','BusinessName');
pt_register('POST','BusinessType');
pt_register('POST','Phone');
pt_register('POST','Email');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($Name=="" || $Phone=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($_SESSION["captcha"]==$_POST["captcha"])
{
    var_dump($_SESSION["captcha"]);
    var_dump($_POST["captcha"]);
}
else
{$error.="<li>Invalid captcha.";$errors=1;
}
if($errors==1) echo $error;
else{
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Business Name: ".$BusinessName."
Business Type: ".$BusinessType."
Phone: ".$Phone."
Email: ".$Email."
Message: ".$Message."
";
$message = stripslashes($message);
mail("test@test.com","Distributor Inquiry - test.com",$message,"From: $Email");
?>


<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<p>Your message has been sent. Below is a copy of your message. <br>
<a href="index.php">Click here to go back</a> </p>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Business Name: </td><td> <?php echo $BusinessName; ?> </td></tr>
<tr><td>Business Type: </td><td> <?php echo $BusinessType; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
<tr><td>Message: </td><td> <?php echo $Message; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->

<?php 
}
?>
0
August 16, 2011

same as before

If i leave the captcha blank, it sends the email.

If i type in the correct captcha, it says invalid email.

0
August 16, 2011

Okay, I'll have to look at the code itself.  I assumed it worked but I'll try to rework it so that it works for sure.

<?php
session_start()
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','BusinessName');
pt_register('POST','BusinessType');
pt_register('POST','Phone');
pt_register('POST','Email');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($Name=="" || $Phone=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($_SESSION["captcha"]==$_POST["captcha"])
{
    var_dump($_SESSION["captcha"]);
    var_dump($_POST["captcha"]);
}
else
{$error.="<li>Invalid captcha.";$errors=1;
}
if($errors==1) {
echo $error;
} else {
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Business Name: ".$BusinessName."
Business Type: ".$BusinessType."
Phone: ".$Phone."
Email: ".$Email."
Message: ".$Message."
";
$message = stripslashes($message);
mail("test@test.com","Distributor Inquiry - test.com",$message,"From: $Email");
?>


<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<p>Your message has been sent. Below is a copy of your message. <br>
<a href="index.php">Click here to go back</a> </p>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Business Name: </td><td> <?php echo $BusinessName; ?> </td></tr>
<tr><td>Business Type: </td><td> <?php echo $BusinessType; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
<tr><td>Message: </td><td> <?php echo $Message; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->

<?php 
}
?>
0
August 16, 2011

Back to this again.

The website cannot display the page

 HTTP 500  

   Most likely causes:

?The website is under maintenance.

?The website has a programming error.

Let me know if you need anything more from me to help me out.

0
August 16, 2011

I tried fixing some things.  Let me know what this does.

<?php
session_start();
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
pt_register('POST','Name');
pt_register('POST','BusinessName');
pt_register('POST','BusinessType');
pt_register('POST','Phone');
pt_register('POST','Email');
pt_register('POST','Message');
$Message=preg_replace("/(\015\012)|(\015)|(\012)/"," <br />", $Message);if($Name=="" || $Phone=="" || $Message=="" ){
$errors=1;
$error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
}
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
$error.="<li>Invalid email address entered";
$errors=1;
}
if($_SESSION["captcha"] == $_POST["captcha"]) {
    var_dump($_SESSION["captcha"]);
    var_dump($_POST["captcha"]);
} else {$error.="<li>Invalid captcha.";$errors=1;
}
if ($errors == 0) {
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Name: ".$Name."
Business Name: ".$BusinessName."
Business Type: ".$BusinessType."
Phone: ".$Phone."
Email: ".$Email."
Message: ".$Message."
";
$message = stripslashes($message);
mail("test@test.com","Distributor Inquiry - test.com",$message,"From: $Email");
}
?>

<?php 
if($errors==1) {
echo $error;
} else {
?>
<!-- This is the content of the Thank you page, be careful while changing it -->

<h2>Thank you!</h2>

<p>Your message has been sent. Below is a copy of your message. <br>
<a href="index.php">Click here to go back</a> </p>

<table width=50%>
<tr><td>Name: </td><td> <?php echo $Name; ?> </td></tr>
<tr><td>Business Name: </td><td> <?php echo $BusinessName; ?> </td></tr>
<tr><td>Business Type: </td><td> <?php echo $BusinessType; ?> </td></tr>
<tr><td>Phone: </td><td> <?php echo $Phone; ?> </td></tr>
<tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
<tr><td>Message: </td><td> <?php echo $Message; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->

<?php 
}
?>
0
August 16, 2011

It worked!!!

Is there a reason it put this at the top of the page after the email is sent? This is the 3 letters i typed. Not a big deal though. I can live with that.

string(3) "5y5" string(3) "5y5"

0
August 16, 2011

Worked. That'll do it. Thanks a lot.

0
August 16, 2011

Hi EMB01,

Can you help on this page.

http://www.experts-exchang e.com/Web_ Developmen t/ WebLang uages-Stan dards/PHP/ Q27145153 .html

It's basically the same thing you just answered for me but on a different contact form on the same website.

0
August 16, 2011

Sure.

Related Questions

Change text color when invalid CAPTCHA

Hello guys, I have just implemented a CAPTCHA routine (with help from the experts here) and want to manage the invalid CAPTCH by changing the text color of the following: &quot;Please enter the code a Read More

Views

62

Votes

0

Answers

16

August 15, 2011

online form not working

We are using http://www.tectite.com/ for an online form on the below website: http://myrascakes.com/orde r.html We keep getting an error and don&#39;t know how to fix it. &#160;There is a r Read More

Views

818

Votes

0

Answers

15

August 15, 2011

This is the very first question

Hello guys! This is the first post in this site Read More

Views

2k

Votes

4

Answers

2

January 08, 2016

report values not showing up.

I have a crystal report which I pass a DataSet to using VB.NET. The report was working fine, but then I make some changes to the import query and now nothing shows up in the crystal report. Crystal do Read More

Views

1k

Votes

0

Answers

12

September 06, 2005

Event log doesn't overwrite as needed in SP4

Hello All, After upgrading from SP3 to SP4 on several Windows 2000 PRO machines everything looked fine, but from time to time applications can&#39;t write to the event log. When I try to view the appl Read More

Views

1k

Votes

0

Answers

9

May 11, 2003

"Failed to self-register XYZ.dll"

Hi there, I wrote a OLE-automation-server DLL in VB4.0. I use Installshield Express to install it as part of my program on the target computers. Now on some computers I get the message &quot;Failed to Read More

Views

2k

Votes

0

Answers

2

November 08, 1998

Please help understand these notes on image processing

Can someone please help me understand these lecture notes... On the right of the page; What does &quot;normalised by one notion of the area of a pixel&quot; mean? On the first formula for A, Is that a Read More

Views

1k

Votes

0

Answers

3

February 05, 2009

Can someone please explain this paragram on the chain rule in image processing

Please see the screenshot, How is 3133030 got from 10103322? Read More

Views

1k

Votes

0

Answers

1

January 05, 2009

AD on 2003

We have created an AD Domain on Windows 2000 Server with no problems. We just created an AD Domain on Windows 2003 and we&#39;re getting some weird problems. Both of these domains are behind firewalls Read More

Views

1k

Votes

0

Answers

15

May 11, 2003

ADDT ASP Upload Error " Type mismatch: 'tNG_isFileInsideBaseFolder' "

I am trying to create a simple insert record and upload image function on an ASP page built using Adobe Dreamweaver Developer Toolkit. I have done this many times before with no problem, however, i ha Read More

Views

1k

Votes

0

Answers

0

November 02, 2008

MYSQL Select query with custom ORDER BY

Hi, is it possible to customize the order of the returned rows in mysql? Example: I have a Table with a column &quot;name&quot;, now I want to have all entries ordered by name, but I want the entries Read More

Views

1k

Votes

0

Answers

5

July 02, 2010

Folder Redirection in Server 2003

We have a Windows Server 2003 Standard Ed. Is there a way to redirect the users my documents to a folder that has already been created on the server? Read More

Views

1k

Votes

0

Answers

2

July 05, 2007

Partiton magic  version 8.0 having error 1523 while executing batch

I followed the partition magic 8.0 wizard to partition my hard disk while rebooting &#160;I came across this problem &#160;&quot;error 1523 while executing batch&quot; What can I do to solve this prob Read More

Views

1k

Votes

0

Answers

2

May 11, 2003

Please explain this paragraph in image processing (screenshot attached)

Two questions; How is the equation (10.1-15) formed? &quot;are isotropic for rotation increments of 90 degrees and 45 degrees respectively&quot; What does this mean Read More

Views

770

Votes

0

Answers

7

January 05, 2009

xp_cmdshell with net use

Hi, when I use &#39;net use \192.168.0.1\c$ password /user:username&#39; at the command prompt, it works fine. &#160;But if i try to use it in sql with &quot; exec master..xp_cmdshell &#39;net use \19 Read More

Views

718

Votes

0

Answers

5

April 11, 2003

hp ux11

i have a hp ux11 server. and i edited the /etc/resolv.conf to use my win2003 server dns server. That went fine, however, I would like to go the other way and add an entry on my win2003 dns to resolve Read More

Views

410

Votes

0

Answers

3

October 12, 2009

Using an application over a LAN

I have written an application that needs to be used on a LAN. &#160;The application setup wizard takes care of registering everything on a single PC, but how do you go about writing a setup program th Read More

Views

358

Votes

0

Answers

9

August 07, 1998

Need subnet of 12 IPs.

Please, Can someone help me to create a subnet consisting of 12 IP&#39;s. Thanks.. Read More

Views

366

Votes

0

Answers

5

April 11, 2003

Drill down in a cross-tabl report

Hello, Would some experts to show me if it is possible to do drill-up or drill-down (or both) in a cross-tab report? I would also like to know if it is possible to control what fields to be displayed/ Read More

Views

294

Votes

0

Answers

0

September 06, 2005

Using RDO, Enterprise V Professional

We would like to use RDO on our project made up of 4 developers. Do we need to have a copy of Enterprise for each developer or is it possible to use Professional for those developers not writing the R Read More

Views

347

Votes

0

Answers

6

January 07, 1998