Page 1 of 1

Quote Form Not working

Posted: Mon Apr 25, 2011 6:55 pm
by thesketchcollective
Hi all,

I'm very new to PHP and have downloaded a pre-made Quote Form that I have attempted to alter slightly and it is now not working correctly.

Below is the code.

Any help would be appreciated.

Code: Select all

<!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=windows-1250" />
       <title>Wen-Kreation Quote Form with field validation</title>
       <meta name="author" content="Jeremie Tisseau" />
       <meta name="copyright" content="Copyright (c) Web-Kreation 2007-2008" />
       <meta name="website" content="http://web-kreation.com" />
       
       <!-- the cascading style sheet-->
       <link href="style.css" rel="stylesheet" type="text/css" />

	   <!-- Mootools Date Picker -->
	   <!-- http://www.electricprism.com/aeron/calendar/ -->
       <link href="calendar.css" rel="stylesheet" type="text/css" />
       <script type="text/javascript" src="js/mootools.js"></script>
  	   <script type="text/javascript" src="js/calendar.js"></script>
       <script type="text/javascript">
	   		window.addEvent('domready', function() {
				myCal = new Calendar({ q6: 'd/m/Y' }, { classes: ['dashboard'], direction: 1 });
			});
	   </script>
       
</head>
  

<body>
     <div id="contentForm">

            <!-- The Quote form starts here-->
            <?php
                 $error             = '';
                 $CompanyName       = '';
                 $FullName          = '';
                 $Email             = '';
				 $Skype             = '';
                 $PhoneNumber       = '';
                 $Country           = '';

                 $DateOnline        = '';
                 $DateFixedFlexible = '';
                 $checkServices     = '';
                 $Budget            = '';
                 
                 $DescribeProject   = '';
                 $Purpose       = '';
                 $Specifics       = '';
                 $NumberProducts    = '';
                 $ContentMaterial   = '';
                 $WebsitesFan       = '';
                 $Competitors       = '';
                 $CommentProject    = '';

                 $CurrentWebsite    = '';
                 $DomainInfo        = '';
                 $HostInfo          = '';
                 $CommentHost       = '';


                 $spamcheck = ''; // Spam check


            if(isset($_POST['send']))
            {

            //Setting up Variables
                 $CompanyName       = $_POST['CompanyName'];
                 $FullName          = $_POST['FullName'];
                 $Email             = $_POST['Email'];
                 $Skype             = $_POST['Skype'];
                 $PhoneNumber       = $_POST['PhoneNumber'];
                 $Country           = $_POST['Country'];

                 $DateOnline        = $_POST['DateOnline'];
                 $DateFixedFlexible = $_POST['DateFixedFlexible'];
                 $Budget            = $_POST['Budget'];
                 //services
                 if (isset($_POST["Services"]) && is_array($_POST["Services"])
                 && count($_POST["Services"]) > 0)
                 {
                   foreach($_POST['Services']  as  $checkServices)  {
                      $Services_msg .= "$checkServices\n";
                   }
                 } // END services

                 $DescribeProject   = $_POST['DescribeProject'];
                 $Purpose       = $_POST['Purpose'];
                 $Specifics       = $_POST['Specifics'];
                 $NumberProducts    = $_POST['NumberProducts'];
	                 if (trim($NumberProducts)  != '') {
						$NumberProducts_msg = '- I will sell '.$NumberProducts.' on my website';
					} else {
						$NumberProducts_msg = '';
					}
          

                 $WebsitesFan       = $_POST['WebsitesFan'];
                 $Competitors       = $_POST['Competitors'];
                 $CommentProject    = $_POST['CommentProject'];

                 $CurrentWebsite    = $_POST['CurrentWebsite'];
                 $DomainInfo        = $_POST['DomainInfo'];
                 $HostInfo          = $_POST['HostInfo'];
                 $CommentHost       = $_POST['CommentHost'];


                 $spamcheck = $_POST['spamcheck'];

                // Generate Error Message if a field is left blank
                if(trim($CompanyName) == '')
                {
                    $error = '<div class="errormsg">Please enter your Company Name!</div>';
                }
                    else if(trim($FullName) == '')
                {
                    $error = '<div class="errormsg">Please enter your Full Name!</div>';
                }
            	    else if(trim($Email) == '')
                {
                    $error = '<div class="errormsg">Please enter your email address!</div>';
                }
                else if(!isEmail($Email))
                {
                    $error = '<div class="errormsg">You have enter an invalid e-mail address. Please, try again!</div>';
                }
		        else if(trim($PhoneNumber) == '')
		        {
		        	$error = '<div class="errormsg">Please enter your phone number!</div>';
		        }
		        else if(!preg_match("/^[0-9]{6,}$/",$PhoneNumber))
		        {
		        	$error = '<div class="errormsg">Please enter a valid phone number!</div>';
		        }
            	else if(trim($Country) == '')
                {
                    $error = '<div class="errormsg">Please enter your Country!</div>';
                }
          	    else if(trim($spamcheck) == '')
                {
                    $error = '<div class="errormsg">Please enter the number for Spam Check!</div>';
                }
          	    else if(trim($spamcheck) != '5')
                {
                     $error = '<div class="errormsg">Spam Check: The number you entered is not correct! 2 + 3 = ??</div>';
                }
                if($error == '')
                {

                    // the email will be sent here
                    // make sure to change this to be your e-mail !!!
                    $to      = "info@thesketchcollective.co.uk"; 

                    // the email subject
                    $subject = '[Questionnaire] : from ' . $FullName;

                    // the mail message
                    $msg     = "\r\n\n***Personal Datas***";
					$msg    .= "\r\n\nFrom: $FullName";
					$msg    .= "\r\nEmail: $Email";
					$msg    .= "\r\nCompany Name: $CompanyName ";
					$msg    .= "\r\nPhone Number: $PhoneNumber ";
					$msg    .= "\r\nSkype Username: $Skype ";
					$msg    .= "\r\nCountry: $Country ";
					$msg    .= "\r\n\n***Project Information:***";
					$msg    .= "\r\n\n- Launch Date: $DateOnline (Date is $DateFixedFlexible)";
					$msg    .= "\r\n\n- Budget: $Budget ";
					$msg    .= "\r\n\n- Services wanted: \r\n$Services_msg .";
					$msg    .= "\r\n\n- Project: \r\n$DescribeProject";
					$msg    .= "\r\n\n- Purpose: \r\n$Purpose ";
					$msg    .= "\r\n\n- Specifics: \r\n$Specifics ";
					$msg    .= "\r\n\n  $NumberProducts_msg";
					$msg    .= "\r\n\n- Inspiration: \r\n$WebsitesFan ";
					$msg    .= "\r\n\n- Competitors: \r\n$Competitors ";
					$msg    .= "\r\n\n- Additional Comments: \r\n$CommentProject ";
					$msg    .= "\r\n\n***Web Hosting Information***";
					$msg    .= "\r\n\n- URL's Web site: $CurrentWebsite. ";
					$msg    .= "\r\n\n- Domain Information:  \r\n$DomainInfo ";
					$msg    .= "\r\n\n- Website Hosting Information: \r\n$HostInfo. ";
					$msg    .= "\r\n\n\n- Additional Comments: \r\n$CommentHost";

                    mail($to, $subject, $msg, "From: $Email\r\nReply-To: $Email\r\nReturn-Path: $Email\r\n");
            ?>

                  <!-- Message sent! (change the text below as you wish)-->
				  <h1 class="quote">Free Quote Demo</h1>
			      <!-- Put your own logo here -->
				  <a href="http://web-kreation.com" title="Web-Kreation"><img src="http://web-kreation.com/wp-content/themes/web-kreation_v2/images/logo.jpg" alt="Web-Kreation - Home" /></a>
                  <h1>Congratulations!!</h1>
                  	<p>Thank you <b><?=$FullName;?></b>, your message is sent! <br />I will get back to you as soon as possible.</p>
                  <!--End Message Sent-->

            <?php
                }
            }
            if(!isset($_POST['send']) || $error != '')
            {
            ?>

		<h1 class="quote">Free Quote Demo</h1>
        <!-- Put your own logo here -->
		<a href="http://web-kreation.com" title="Web-Kreation"><img src="http://web-kreation.com/wp-content/themes/web-kreation_v2/images/logo.jpg" alt="Web-Kreation - Home" /></a>

		<!-- Start Questionnaire -->
          <form  method="post" id="msgform" action="">
                <h1>Fill the Questionnaire</h1>
                    <p>No one enjoys filling out forms, but for your project to be successful I need some information about your website.</p>
					<p><small>This is only a demo. Don't try to contact me via this form. I won't receive the mail!</small></p>

            <!--Error Message-->
            <?=$error;?>


                <h1>Personal Info</h1>
				   <!-- Company Name -->
                   <p><label>Company Name <span class="required">*</span></label>
                   <input type="text" size="40" value="<?=$CompanyName;?>" name="CompanyName" id="q1" /></p>
				   <!-- Full Name -->
                   <p><label >Your Full Name: <span class="required">*</span></label>
                   <input type="text" size="40" value="<?=$FullName;?>" name="FullName" id="q2" /></p>
				   <!-- Email -->
                   <p><label >E-mail:<span class="required">*</span></label>
                   <input type="text" size="40" value="<?=$Email;?>" name="Email" id="q3"  /></p>
				   <!-- Phone -->
                   <p><label >Phone Number <span class="required">*</span></label>
                   <input type="text" size="40" value="<?=$PhoneNumber;?>" name="PhoneNumber" id="q4" /></p>
                   <!-- Country -->
                   <p><label>Country <span class="required">*</span></label>
                   <select name="Country" id="q5" >
                   <option></option>
                   
                    <option>United Kingdom</option>
                    <option>United States</option>
                   
                   </select></p>

				   <p><b>Optional:</b></p>
                   <!-- Skype Username -->
                   <p><label >Skype Username:</label>
                   <input type="text" size="40" value="<?=$Skype;?>" name="Skype" id="q3_skype"  /></p>

				   	<br class="endOfSection" />

                  <h1>Describe your project</h1>
				  	<!-- Launch Date -->
                    <p><label>Launch date <small>(e.g. 08/05/2008)</small> </label>
					<input type="text" size="40" value="<?=$DateOnline;?>" name="DateOnline" id="q6" /></p>
                    <!-- Date fixed or Flexible -->
                    <p><label>Is your launch date fixed or flexible? </label>
                    <select name="DateFixedFlexible" id="q6bis" >
                    <option></option>
                        <option>Fixed</option>
                        <option>Flexible</option>
                    </select></p>
                    <!-- Services desired -->
                    <label>What services do you require?</label>
                    <div class="fright">
                    <p> <label><input type="checkbox" name="Services[]" id="q12_1" value="Web Design" />
                    Web Design</label>
                    <label><input type="checkbox" name="Services[]" id="q12_2" value="Web Maintenance"   />
                    Web Maintenance</label>
                    <label><input type="checkbox" name="Services[]" id="q12_3" value="Weblog  Blog"   /> Weblog (Blog)</label>
                    <label><input type="checkbox" name="Services[]" id="q12_4" value="Graphic Design"   /> 
                    Graphic Design</label>
                    <label><input type="checkbox" name="Services[]" id="q12_5" value="Illustration"   /> 
                    Illustration</label>
                    <label><input type="checkbox" name="Services[]" id="q12_6" value="E-commerce"   /> 
                    E-commerce (Online Shop)</label>
                    <label><input type="checkbox" name="Services[]" id="q12_7" value="Product Photography"   /> 
                    Product Photography</label>
                    <label><input type="checkbox" name="Services[]" id="q12_8" value="Portrait Photography"   /> 
                    Portrait Photography</label>
                    <label><input type="checkbox" name="Services[]" id="q12_9" value="Architectual Photography"   /> 
                    Architectual Photography</label>
                    <label><input type="checkbox" name="Services[]" id="q12_10" value="SEO"   /> 
                    Search Engine Optimisation</label>
                    <label><input type="checkbox" name="Services[]" id="q12_12" value="Other, contact me"   /> Other, contact me.</label>
                    </p>
                     </div>
                    <!-- Budget -->
                    <p><label>Project Budget</label>
                    <select name="Budget" id="q8" >
                    <option></option>
                        <option>1000€ - 1499€</option>
                        <option>1500€ - 1999€</option>
                        <option>2000€ - 2999€</option>
                        <option>3000€ - 4999€</option>
                        <option>5000€ - 9999€</option>
                        <option>10.000€ - 14.999€</option>
                        <option>+ 15.000€</option>
                        <option>Other. Please, contact me.</option>
                    </select></p>
                    <!-- Project description -->
                    <p>
                    <label>Describe briefly project.</label>
                    <textarea cols="40" rows="6" name="DescribeProject" id="q9" ></textarea></p>
                    <!-- Purpose of the site -->
                    <p>
                    <label>What is the primary purpose of the project? <small>(e.g. To make a sell, to make an inquiry, to show your portfolio...)</small></label>
                    <textarea cols="40" rows="6" name="Purpose" id="q10" ></textarea></p>
                    <!-- Number of pages -->
                    <p>
                    <label>Project Specifics <small>(e.g If a website, how many pages?)</small></label>
                    <textarea cols="40" rows="4" name="Specifics" id="q11" ></textarea></p>
					<!-- Features -->
                    <label>What services do you require?</label>
                    <div class="fright">
                   
                    </div>
				   	<br class="endOfSection" />
					<!-- How many products will you sell -->
                    <p><label>If E-commerce, how many products will you sell?</label>
                    <select name="NumberProducts" id="q13" >
                    <option></option>
                      <option>Less than 50 products</option>
                      <option>50 to 100 products</option>
                      <option>More than 100 products</option>
                      <option>Don't know yet</option>
                    </select></p>
					<!-- Content - Materials -->
                    <label>Will you be providing any of the following content or materials?</label>
                    <div class="fright">
                    <label><input type="checkbox" name="ContentMaterial" id="q14_1" value="No - We need help with every aspect of our site"   /> No - We need help with every aspect of our site</label>
                    <label><input type="checkbox" name="ContentMaterial" id="q14_2" value="No - But you can use existing Brochures/Literatures to write the content"   /> No - But you can use existing Brochures/Literatures to write the content</label>
                    <label><input type="checkbox" name="ContentMaterial" id="q14_3" value="Yes - We will provide copy/text for our site"   /> Yes - We will provide copy/text for our site</label>
                    <label><input type="checkbox" name="ContentMaterial" id="q14_4" value="Yes - We will provide images/graphics"   /> Yes - We will provide images/graphics</label>
                    <label><input type="checkbox" name="ContentMaterial" id="q14_5" value="Yes - We will provide the Logo of our company"   /> Yes - We will provide the Logo of our company</label>
                    <label><input type="checkbox" name="ContentMaterial" id="q14_6" value="Yes - We will provide video/music"   /> Yes - We will provide video/music</label>
                    <label><input type="checkbox" name="ContentMaterial" id="q14_7" value="Yes - We will provide other kind of media/files"   /> Yes - We will provide other kind of media/files</label>
                    <label><input type="checkbox" name="ContentMaterial" id="q14_8" value="Not Applicable"   /> Not Applicable</label>
                    <label><input type="checkbox" name="ContentMaterial" id="q14_9" value="Other - Please, contact me"   /> Other - Please, contact me</label>
                    </div>
				   	<br class="endOfSection" />
                    <!-- Inspiration -->
                    <p><label>URL of Web sites you like <br /><small>e.g. http://site.com</small></label>
                    <textarea cols="40" rows="3" name="WebsitesFan" id="q15"></textarea></p>
                    <!-- Competitors -->
                    <p><label>Competitors URL  <br /><small>e.g. http://competitor.com</small></label>
                    <textarea cols="40" rows="3" name="Competitors" id="q16"></textarea></p>
                    <!-- Additional Comments -->
                    <p><label>Additional Comments</label>
                    <textarea cols="40" rows="3" name="CommentProject" id="q17" ></textarea></p>

				   	<br class="endOfSection" />

                 <h1>Web hosting information</h1>
				   <!-- Website url -->
                   <p><label >Current Web site URL <br /><small>(if applicable)</small></label>
                   <input type="text" size="40" value="<?=$CurrentWebsite;?>" name="CurrentWebsite" id="q18"  /></p>
                   <!-- Domain Information -->
                   <p><label>Domain Information</label>
                   <select name="DomainInfo" id="q19" >
                   <option></option>
                      <option>Need to Register a Domain</option>
                      <option>Already have a domain</option>
                    <option>Don't know, contact me</option>
                      <option>Not Appicable</option>
                   </select></p>
                   <!-- Website Hosting Information -->
                   <p><label>Website Hosting Information</label>
                   <select name="HostInfo" id="q20" >
                   <option></option>
                    <option>Need help me to find a host</option>
                    <option>Already have a Host </option>
                    <option>Don't know, contact me</option>
                    <option>Not Applicable</option>
                   </select></p>
                   <!-- Additional Comments -->
                   <p><label>Additional Comments</label>
                   <textarea cols="40" rows="3" name="CommentHost" id="q21" ></textarea></p>

				   	<br class="endOfSection" />

                 <h1>You are almost done!</h1>
                    <p>Fill the field below to prevent Spams and click the 'submit' button to email the form to me.<br /><br /></p>
                    <!-- Spam check -->
                    <p><label>Answer the math Question: <b>2 + 3= </b></label>
          			<input name="spamcheck" type="text" class="box" id="spamcheck" size="4" value="<?=$spamcheck;?>" /></p>

				   	<br class="endOfSection" />
		            <!--Error Message-->
		            <?=$error;?>

                    <input name="send" type="submit" class="button" id="send" value=""/>
              </form>

Re: Quote Form Not working

Posted: Mon Apr 25, 2011 8:31 pm
by superdezign
That's a lot of code for you to give absolutely no indication of what the problem is. Tell us what it's supposed to do, what it's actually doing, and which code you think may be responsible.