logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 09-02-2011, 03:21 PM   #1
Villavicencio
 
Join Date: Sep 2011
Posts: 6
Default PHP frustration.

I always seem soooo close to getting my contact page to work. I am getting the email BUT the name and company fields are not working. Can someone please tell me where I am going wrong?!

The contact form:
Code:
<table cellpadding="0" cellspacing="0" border="0" class="maintext">
  
  <form action="contactformprocess.php" method="post" id="contactform">
  <tr>
  <td width="107" align="right"><label for= "name">Name&nbsp;</label></td><td width="356"><input name="name" id="name"  type="text" style="width:310px; height:20px;"  /></td></tr>
    <tr><td height="5"></td></tr
><tr>
<td align="right"><label for="company">Company&nbsp;</label></td><td><input name="company" id="company"  type="text" style="width:310px; height:20px;"  /></td></tr
>
<tr><td height="5"></td></tr>
<tr>
<td align="right"><label for= "email">Email Address&nbsp;</label></td><td><input name="email" id="email"  type="text" style="width:310px; height:20px;"  /></td></tr
>
<tr><td height="5"></td></tr>
<tr>
<td align="right"><label for= "subject">Subject &nbsp;</label></td><td><input name="subject" id="subject"  type="text" style="width:310px; height:20px;"  /></td></tr
>
<tr><td height="5"></td></tr><tr>
<td align="right">Message &nbsp;</td><td><textarea name="message" style="width:310px; height:100px;"></textarea>
</td></tr
>  
<tr><td height="5"></td></tr>
<tr>
<td></td>
<td><p>
  <input type="submit" name="submit" value="submit">
</p></td>
</tr>
</tr></form></table>
My php code
PHP Code:
<?php

/* Email Variables */
$emailSubject 'amddetailing.com';
$webMaster 'contactus@amddetailing.com';
/* Data Variables */

$name $_POST['name'];
$company $_POST['company'];
$email $_POST['email'];
$subject $_POST['subject'];
$message $_POST['message'];

$body = <<<EOD
<br><hr><br>
Name: 
$name1 <br>
Company: 
$company1 <br>
Email: 
$email <br>
Subject: 
$subject <br>
Message: 
$message <br>

EOD;

$headers "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success mail($webMaster$emailSubject$body$headers);

/* Results rendered as HTML */

$theResults = <<<EOD

<html>

<head>

<title>sent message</title>

<meta http-equiv="refresh" content="2;URL=http://www.amddetailing.com/">

<style type="text/css">

<!--

body {

background-color: #EDF4FF;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 20px;

font-style: normal;

line-height: normal;

font-weight: normal;

color: #000033;

text-decoration: none;

padding-top: 200px;

margin-left: 150px;

width: 800px;

}
-->
</style>
</head>
<div align="center">Your email will be answered soon as possible!
<br/>
You will return to Aircraft Mobile Detailing in a few seconds !</div>
</div>
</body>
</html>

EOD;

echo 
"$theResults";

?>
Villavicencio is offline   Reply With Quote
Old 09-02-2011, 03:47 PM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

in $body it should be$name and $company drop the 1 and it should be fine
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 09-02-2011, 05:59 PM   #3
Villavicencio
 
Join Date: Sep 2011
Posts: 6
Smile Thank You!!

That code was driving me crazy. I knew there was something small I was missing. Now that I have figured it out. I am having trouble with another form.

I am not getting the information from my check boxes in my quote area. Thank you for taking a look at this. This is my first time doing this.

Code:
<form action="quoteformprocess.php" method="post" name="Quote">
<div class="div2">
      Please select the service(s) you require for your Airplane and submit your request for quotation / service.
     

      <table id="CheckBoxServices" class="span2" border="0" style="width:825px;">

        <tr>
            <td width="401"><input id="CheckBoxServices_1" type="checkbox" name="CheckBoxServices$1" /><label for="CheckBoxServices_1"> Trip Ready Exterior Clean</label></td>
                <td width="414"><input id="CheckBoxServices_2" type="checkbox" name="CheckBoxServices$2" /><label for="CheckBoxServices_2"> Trip Ready Interior Clean</label></td>

        </tr><tr><td>&nbsp;</td></tr>
        <tr>

                <td><input id="CheckBoxServices3" type="checkbox" name="CheckBoxServices3" /><label for="CheckBoxServices3"> Wet Wash Aircraft</label></td>
                <td><input id="CheckBoxServices4" type="checkbox" name="CheckBoxServices4" /><label for="CheckBoxServices4">Window Cleaning</label></td>

        </tr><tr>
                <td><input id="CheckBoxServices5" type="checkbox" name="CheckBoxServices5" /><label for="CheckBoxServices5">Dry Wash Aircraft</label></td>
                <td><input id="CheckBoxServices6" type="checkbox" name="CheckBoxServices6" /><label for="CheckBoxServices6">Carpet Extraction</label></td>

        </tr><tr>

                <td><input id="CheckBoxServices7" type="checkbox" name="$CheckBoxServices7" /><label for="CheckBoxServices7">Hand Wax Exterior Paint</label></td>
                <td><input id="CheckBoxServices8" type="checkbox" name="$CheckBoxServices8" /><label for="CheckBoxServices8">Upholstery Dry Cleaning</label></td>

        </tr><tr>

                <td><input id="CheckBoxServices9" type="checkbox" name="CheckBoxServices9" /><label for="CheckBoxServices9">Machine Buff Exterior Paint</label></td>
                <td><input id="CheckBoxServices10" type="checkbox" name="CheckBoxServices10" /><label for="CheckBoxServices10">Stain Removal</label></td>

        </tr><tr>

                <td><input id="CheckBoxServices11" type="checkbox" name="CheckBoxServices11" /><label for="CheckBoxServices11">BrightWork / Polish Leading Edges</label></td>
                <td><input id="CheckBoxServices12" type="checkbox" name="CheckBoxServices12" /><label for="CheckBoxServices12">Fabric & Leather Cleaning</label></td>

        </tr><tr>

                <td><input id="CheckBoxServices13" type="checkbox" name="CheckBoxServices13" /><label for="CheckBoxServices13">De-Ice Boots Refurbish</label></td>
                <td><input id="CheckBoxServices14" type="checkbox" name="CheckBoxServices14" /><label for="CheckBoxServices14">Wood & Trim Polishing</label></td>

        </tr><tr><td><input id="CheckBoxServices15" type="checkbox" name="CheckBoxServices15" /><label for="CheckBoxServices15">Clean Gear Wells</label></td>
        		<td><input id="CheckBoxServices16" type="checkbox" name="CheckBoxServices16" /><label for="CheckBoxServices16"> Lavatory Sanitation</label></td></tr>
        <tr>
                <td>&nbsp;</td><td>&nbsp;</td>
        </tr><tr>
                <td valign="top">
                <input id="CheckBoxServices_17" type="checkbox" name="CheckBoxServices$17" /><label for="CheckBoxServices_17">PERMAGARD Coating &amp; Sealant</label></td>
                <td><label for="other">Other (Specify) <br /></label>
  <textarea name="other" rows="2" id="other"></textarea></td>
        </tr></table></div>  
<div class="div2">Customer Information
<table>
<tr>
<td height="61">
        <div class="div3">

            <div class="nameArea"><label for="name">Name:</label></div>
            <div class="InputArea"><input name="name" type="text" class="text" id="name" />
              <span class="error">&nbsp;*</span></div>
            <span id="RequiredFieldValidator1" style="color:White;display:none;">*</span>

        </div></td><td>
        <div class="div3">

            <div class="nameArea"><label for="company">Company Name:</label></div>

            <div class="InputArea"><input name="company" type="text" id="company" class="text" /></div>

           </div>
        
</td>
<tr> <td><div class="div3">

            <div class="nameArea"><label for="phone">Phone:</label></div>
            <div class="InputArea"><input name="phone" type="text" id="phone" class="text" /></div>
        </div>

</td><td>
        <div class="div3">
            <div class="nameArea"><label for="fax">Fax:</label></div>
            <div class="InputArea"><input name="fax" type="text" id="fax" class="text" /></div>

        </div>
   </td></tr>
        
        <tr><td>
        <div class="div3">

            <div class="nameArea"><label for="email">E-mail:</label></div>

            <div class="InputArea"><input name="email" type="text" id="email" class="text" />
            <span class="error">&nbsp;*</span></div>
            <span id="ValidEmail" style="color:White;display:none;">*</span>

            <span id="EmailRegexValidator" style="color:White;display:none;">*</span>

        </div>
        </td>
         <td>
<div class="div3">
            <div class="nameArea"><label for="address">Address:</label></div>
            <div class="InputArea"><textarea name="address" rows="3" cols="5" id="address" class="text"></textarea></div>

        </div>
        </td></tr>
         <tr><td>
         <div class="div3">

            <div class="nameArea"><label for="aircrafttype">Aircraft Type:</label></div>
            <div class="InputArea"><input name="aircrafttype" type="text" class="text" id="aircrafttype" size="90" /></div>
        </div>
         </td>
         <td>
         <div class="div3">
            <div class="nameArea"><label for="aircraftmodel">Aircraft Model:</label></div>
            <div class="InputArea"><input name="aircraftmodel" type="text" id="aircraftmodel" class="text" /></div>

        </div>
        </td></tr>
        <tr><td>
         <div class="div3">
            <div class="nameArea"><label for="aircraftlocation">Aircraft Location:</label></div>
            <div class="InputArea"><input name="aircraftlocation" type="text" class="text" id="aircraftlocation" size="90" /></div>
        </div>
         </td>
         <td>
        </td></tr>
         </table>

   
      </div>
         <div class="bodyPan1" >

        <div class="div5">

        Fields marked with<span class="required">&nbsp;*&nbsp;</span>are required<br />
          
          
          <input type="submit" name="submit" value="submit">

        </div></div>
<!-- stop editing from here --><br clear="all" />
<!-- tagline below this mark --><!-- end .content -->
</form>
PHP Code:
<?php

/* Email Variables */

$emailSubject 'quoteformprocess';

$webMaster 'contactus@amdetailing.com';


/* Data Variables */

$name $_POST['name'];
$company $_POST['company'];
$phone $_POST['phone'];
$fax $_POST['fax'];
$email $_POST['email'];
$address $_POST['address'];
$aircrafttype $_POST['aircrafttype'];
$aircraftmodel $_POST['aircraftmodel'];
$aircraftlocation $_POST['aircraftlocation'];

$CheckBoxServices1 $_POST['Trip Ready Exterior Clean'];
$CheckBoxServices2 $_POST['Trip Ready Interior Clean'];
$CheckBoxServices3 $_POST['Wet Wash Aircraft'];
$CheckBoxServices4 $_POST['Window Cleaning'];
$CheckBoxServices5 $_POST['Dry Wash Aircraft'];
$CheckBoxServices6 $_POST['Carpet Extraction'];
$CheckBoxServices7 $_POST['Hand Wax Exterior Paint'];
$CheckBoxServices8 $_POST['Upholstery Dry Cleaning'];
$CheckBoxServices9 $_POST['Machine Buff Exterior Paint'];
$CheckBoxServices10 $_POST['Stain Removal'];
$CheckBoxServices11 $_POST['BrightWork / Polish Leading Edges'];
$CheckBoxServices12 $_POST['Fabric & Leather Cleaning'];
$CheckBoxServices13 $_POST['De-Ice Boots Refurbish'];
$CheckBoxServices14 $_POST['Wood & Trim Polishing'];
$CheckBoxServices15 $_POST['Clean Gear Wells'];
$CheckBoxServices16 $_POST[' Lavatory Sanitation'];
$CheckBoxServices17 $_POST['PERMAGARD Coating Sealant'];
$other $_POST['other'];


$body = <<<EOD

<br><hr><br>
Contact Information <br>
Name: 
$name <br>
Company: 
$company <br>
Phone: 
$phone <br>
Fax: 
$fax <br>
Email: 
$email <br>
Address: 
$address <br>
Aircraft type: 
$aircrafttype <br>
Aircraft Model: 
$aircraftmodel <br>
Aircraft Location : 
$aircraftlocation <br><br>
Services Requested <br>
Trip Ready Exterior Clean: 
$CheckBoxServices1 <br>
Trip Ready Interior Clean: 
$CheckBoxServices2 <br>
Wet Wash: 
$CheckBoxServices3 <br>
Window Cleaning: 
$CheckBoxServices4 <br>
Dry Wash: 
$CheckBoxServices5 <br>
Carpet Extraction: 
$CheckBoxServices6 <br>
Hand Wax Exterior Paint: 
$CheckBoxServices7 <br>
Upholstery Dry Cleaning: 
$CheckBoxServices8 <br>
Machine Buff Exterior Paint: 
$CheckBoxServices9 <br>
Stain Removal: 
$CheckBoxServices10 <br>
Brightwork: 
$CheckBoxServices11 <br>
Fabric Leather Cleaning: 
$CheckBoxServices12 <br>
De Ice Boots: 
$CheckBoxServices13
Wood Trim Polishing: 
$CheckBoxServices14 <br>
Clean Gear Wells: 
$CheckBoxServices15 <br>
Lavatory Sanitation: 
$CheckBoxServices16 <br>
PERMAGARD Coating Sealant: 
$CheckBoxServices17 <br>
Other: 
$other <br>

EOD;

$headers "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success mail($webMaster$emailSubject$body$headers);

/* Results rendered as HTML */
EOD;

$headers "From: $email\r\n";

$headers .= "Content-type: text/html\r\n";

$success mail($webMaster$emailSubject$body,

$headers);


$theResults = <<<EOD

<html>

<head>

<title>sent message</title>

<meta http-equiv="refresh" content="2;URL=http://www.amdetailing.com/">

<style type="text/css">

<!--

body {

background-color: #EDF4FF;

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 20px;

font-style: normal;

line-height: normal;

font-weight: normal;

color: #000033;

text-decoration: none;

padding-top: 200px;

margin-left: 150px;

width: 800px;

}
-->
</style>
</head>
<div align="center">Your email will be answered soon as possible!
<br/>
You will return to Aircraft Mobile Detailing in a few seconds !</div>
</div>
</body>
</html>

EOD;

echo 
"$theResults";

?>
Villavicencio is offline   Reply With Quote
Old 09-03-2011, 02:10 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

your post values are wrong , use the names hers the list of your post values that are passed

on stipulating that the check box has been selected

Code:
CheckBoxServices$1 : on
CheckBoxServices$2 : on
CheckBoxServices3 : on
CheckBoxServices4 : on
CheckBoxServices5 : on
CheckBoxServices6 : on
$CheckBoxServices7 : on
$CheckBoxServices8 : on
CheckBoxServices9 : on
CheckBoxServices10 : on
CheckBoxServices11 : on
CheckBoxServices12 : on
CheckBoxServices13 : on
CheckBoxServices14 : on
CheckBoxServices15 : on
CheckBoxServices16 : on
CheckBoxServices$17 : on
other : other
name : name
company : Company Name:
phone : phone
fax : Fax:
email : email
address : Address:
aircrafttype : Aircraft Type:
aircraftmodel : Aircraft Model:
aircraftlocation : Aircraft Location:
submit : submit
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 09-03-2011, 04:04 PM   #5
Villavicencio
 
Join Date: Sep 2011
Posts: 6
Default Thank you, again

That worked perfectly. I am so glad I found this site. You have been a lifesaver
Villavicencio is offline   Reply With Quote
Old 09-24-2011, 01:32 PM   #6
gigiloumill
gigiloumill's Avatar
 
Join Date: Apr 2009
Location: Miami, FL
Posts: 493
Default

He's a genius...
__________________
Keeping your business connected.
www.starionmedia.com
gigiloumill is offline   Reply With Quote
Old 09-26-2011, 02:15 AM   #7
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

haha my mother speaks well of me sometimes
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 02-16-2012, 09:44 PM   #8
Villavicencio
 
Join Date: Sep 2011
Posts: 6
Default

Hey,

thank you so much for helping me with this. It has been working perfectly, a little too perfectly in that I have been getting blank submits. The php is working because I have tested it.

Is there a way I can make name and email fields required in this script which will force the person to submit contact information?
Villavicencio is offline   Reply With Quote
Old 02-17-2012, 01:17 AM   #9
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

yes cheap and cheerful way would be to use die() although some php purists would get funky about it being for debugging try this at the top of your script
Code:
if($_POST['name'] || $_POST['email'] ==" "){
die("please go back and fill in the required fiels email and name:):
test and let me know as i havent
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 02-17-2012, 04:22 AM   #10
Villavicencio
 
Join Date: Sep 2011
Posts: 6
Default

I tried and it did not work. All I got was a blank page.
Villavicencio is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:57 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com