close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Contactus.php form is not sending form data

Thread began 1/16/2010 2:53 am by edgar294281 | Last modified 4/12/2010 12:53 pm by i.edwards384429 | 8886 views | 21 replies |

edgar294281

Contactus.php form is not sending form data

I've installed the contact form solution pack. I got the form placed into an exiting webpage and uploaded it on the web server. The form looks great but is not sending anything. I click the submit button and nothing happens. The information that were placed in the form resets.

Question?
1. Do I need to give the contactus.php a "form Action" or leave it blank?

Can someone provide solutions.

EP

Sign in to reply to this post

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.

Sign in to reply to this post

edgar294281

Contactus form not working

Thank for providing us with this information. I will try this today.
What is strange....We did not remove any code. This is the same file that was downloaded from Webassist. Can you check and verify. We need to know because if we need to download a fresh copy it would be a bad copy.

Edgar

Sign in to reply to this post

Jason ByrnesWebAssist

I'm confused. In your initial question you say:

  I got the form placed into an exiting webpage  




This suggests to me that you are copying the form from the supplied contactus.php page into another page. Is this not the case?

Sign in to reply to this post

edgar294281

No, we used the same form that was downloaded from Webassist.

Also, the code that you provided included a fill for phone number which was not in the download from Webassist. The number fill is good to have but it is in the wrong place.
It is following the submit button.

Edgar

Sign in to reply to this post

Jason ByrnesWebAssist

please post a copy of your contact page.

Sign in to reply to this post

edgar294281

Jason,

I tried the form again but it still did not work.

I am attaching the content of the form so you can see what I have configured.

Attached Files
contactus-form-content.zip
Sign in to reply to this post

Jason ByrnesWebAssist

I'm sorry, the code I copied initially was from a contact form I had modified slightly, the phone number should not have been included.

I have modified the code in my previous reply to be the code from an unmodified contactus.php page.


I would like you to upload the attached file to your server to see if session management is working. Once uploaded, can you please provide a link.

Sign in to reply to this post

edgar294281

Jason,
The form has been uploaded already.

This is a link to the form. I have not changed anything to code of the zipped file that I emailed back to you.

contactus.php

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this further. to view and edit your support incident, please log into your support history:
supporthistory.php?

Sign in to reply to this post
loading

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...