close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Contactus.php form is not sending form data

Thread began 1/15/2010 11:53 pm by edgar294281 | Last modified 4/12/2010 9:53 am by edgar294281 | 11581 views | 21 replies

Jason ByrnesWebAssist

No, the action of the form should be left blank.


For the contact form to function you need to make sure you have copied all of the needed code from the original contactus.php page to your existing page.

There are three code chunks you need:

1) All of the code from line 1 of the contactus.php page until the <doctype...> tag:

php:
<?php require_once('WA_Globals/WA_Globals.php');?>
<?php 
require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php 
require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?>
<?php 
require_once("WA_Universal_Email/mail_PHP.php"); ?>
<?php 
require_once("WA_Universal_Email/MailFormatting_PHP.php"); ?>
<?php 
if ($_SERVER["REQUEST_METHOD"] == "POST")  {
  
$WAFV_Redirect "";
  
$_SESSION['WAVT_contact_Errors'] = "";
  if (
$WAFV_Redirect == "")  {
    
$WAFV_Redirect $_SERVER["PHP_SELF"];
  }
  
$WAFV_Errors "";
  
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Contact_Name"]))?$_POST["Contact_Name"]:"") . "",true,1);
  
$WAFV_Errors .= WAValidateEM(((isset($_POST["Email_address"]))?$_POST["Email_address"]:"") . "",true,2);
  
$WAFV_Errors .= WAValidateRQ(((isset($_POST["Comments"]))?$_POST["Comments"]:"") . "",true,3);
  
$WAFV_Errors .= WAValidateLE(((isset($_POST["Security_code"]))?strtolower($_POST["Security_code"]):"") . "",((isset($_SESSION["captcha_1"]))?strtolower($_SESSION["captcha_1"]):"") . "",true,4);
  
$WAFV_Errors .= WAValidateLE(((isset($_POST["Security_question"]))?strtolower($_POST["Security_question"]):"") . "",((isset($_SESSION["random_answer"]))?strtolower($_SESSION["random_answer"]):"") . "",true,5);
  
$WAFV_Errors .= WAValidateRX(((isset($_POST["addblock"]))?$_POST["addblock"]:"") . "","/^$/i",false,6);
  
$WAFV_Errors .= WAValidateRX(((isset($_POST["seconddblock"]))?$_POST["seconddblock"]:"") . "","/^$/i",false,7);

  if (
$WAFV_Errors != "")  {
    
PostResult($WAFV_Redirect,$WAFV_Errors,"contact");
  }
}
?>
<?php
if ((($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)))     {
  
//WA Universal Email object="mail"
  //Send Loop Once Per Entry
  
$RecipientEmail "".($WAGLOBAL_Contact_Email_To)  ."";include("WA_Universal_Email/WAUE_contact_1.php");

  
//Send Mail All Entries
  
if ("index.php"!="")     {
    
header("Location: thankyou.php");
  }
}
?>




2) in the head, you need to copy the spry assets code:

php:
<script  src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script  src="SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<style>
.textfieldServerError {
  display:block;
  margin:0px;
  color:#CC3333;
  border: 1px solid #CC3333;
}
</style>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />




in the body, you need to copy the entire form, including the spry init code:

php:
<form  action="" method="post" name="emailContact" id="emailContact" onsubmit="">
  <div style="width:100%">
    <label for="Contact_Name" >Your name:</label>
    <br />
    <span id="sprytextfield1">
    <input name="Contact_Name" type="text" class="inputValue" id="Contact_Name" onblur="if (document.getElementById('nameServerError')) document.getElementById('nameServerError').style.display='none'" value="<?php echo(ValidatedField("contact","Contact_Name")) ?>" />
    <span class="textfieldRequiredMsg">A value is required.</span></span>
    <input name="addblock" type="text" id="addblock" style="display:none" value="" />
    <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "1" ",") !== false || "1" == ""))  {
    if (!(
false))  {
?>
    <span id="nameServerError" class="textfieldServerError">Please provide your name.</span>
    <?php //WAFV_Conditional contact.php contact(1:)
    
}
  }
}
?>
    <br />
    <label for="Email_address" >E-mail address:</label>
    <br />
    <span id="sprytextfield2">
    <input name="Email_address" type="text" class="inputValue" id="Email_address" onblur="if (document.getElementById('emailServerError')) document.getElementById('emailServerError').style.display='none'" value="<?php echo(ValidatedField("contact","Email_address")) ?>" />
    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
    <input name="seconddblock" id="seconddblock" type="text" style="display:none" value="" />
    <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "2" ",") !== false || "2" == ""))  {
    if (!(
false))  {
?>
    <span id="emailServerError" class="textfieldServerError">Please provide your email addess so we can get back in touch with you.</span>
    <?php //WAFV_Conditional contact.php contact(2:)
    
}
  }
}
?>
    <br />
    <label for="Comments" >Comments:</label>
    <br />
    <span id="sprytextarea1">
    <textarea name="Comments" class="inputText" id="Comments" onblur="if (document.getElementById('commentsServerError')) document.getElementById('commentsServerError').style.display='none'" ><?php echo(ValidatedField("contact","Comments")) ?></textarea>
    <span class="textareaRequiredMsg">A value is required.</span></span>
    <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "3" ",") !== false || "3" == ""))  {
    if (!(
false))  {
?>
    <span id="commentsServerError" class="textfieldServerError">Please let us know how we can assist you.<br />
    </span>
    <?php //WAFV_Conditional contact.php contact(3:)
    
}
  }
}
?>
    <label for="Security_code" ><br />
    Security code:</label>
    <br />
    <img  src="WA_ValidationToolkit/WAVT_CaptchaSecurityImages.php?noisecolor=<?php echo $WAGLOBAL_Captcha_Noise?>&bgcolor=<?php echo $WAGLOBAL_Captcha_BG?>&textcolor=<?php echo $WAGLOBAL_Captcha_Text?>&transparent=<?php echo $WAGLOBAL_Captcha_BG_transparent?>&characters=<?php echo $WAGLOBAL_Captcha_Characters?>&width=<?php echo $WAGLOBAL_Captcha_Width?>&height=<?php echo $WAGLOBAL_Captcha_Height?>&font=<?php echo $WAGLOBAL_Captcha_Font?>" alt="security code" /><br  />
    <span id="sprytextfield3">
    <input name="Security_code" type="text" class="inputValue" id="Security_code" onblur="if (document.getElementById('captchaServerError')) document.getElementById('captchaServerError').style.display='none'" maxlength="40" />
    <span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span>
    <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "4" ",") !== false || "4" == ""))  {
    if (!(
false))  {
?>
    <span id="captchaServerError" class="textfieldServerError">Your security code entry did not match the image.</span>
    <?php //WAFV_Conditional contact.php contact(4:)
    
}
  }
}
?>
    <br />
    <label for="Security_code" >
      <?php require_once("WA_ValidationToolkit/WAVT_CaptchaSecurityQuestion.php"); ?>
    </label>
    <br />
    <span id="sprytextfield4">
    <input name="Security_question" type="text" class="inputValue" id="Security_question" onblur="if (document.getElementById('securityServerError')) document.getElementById('securityServerError').style.display='none'" maxlength="40" />
    <span class="textfieldRequiredMsg">A value is required.</span></span>
    <?php
if (ValidatedField("contact","contact"))  {
  if ((
strpos((",".ValidatedField("contact","contact").","), "," "5" ",") !== false || "5" == ""))  {
    if (!(
false))  {
?>
    <span id="securityServerError" class="textfieldServerError">Your answer was not correct.</span>
    <?php //WAFV_Conditional contact.php contact(4:)
    
}
  }
}
?>
    <br />
    <input type="submit" value="Submit" class="inputButton"/>
  </div>
</form>
<script type="text/javascript">
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "email", {validateOn:["blur"]});
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1", {validateOn:["blur"]});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {validateOn:["blur"], minChars:<?php echo $WAGLOBAL_Captcha_Characters?>, maxChars:<?php echo $WAGLOBAL_Captcha_Characters?>});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "none", {validateOn:["blur"]});
//-->
</script>




Make sure you dont change the names of any of the form elements. Also, if you remove any of them, you will need to remove the code that validates that form element.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...