www.webdeveloper.com
Results 1 to 4 of 4

Thread: Contact form sendmail.php Confusion with Sending from Dropdowns?

  1. #1
    Join Date
    May 2009
    Posts
    100

    Contact Form Issue?

    The issue is in the post below.

    Thanks
    Last edited by Nerdygeek; 04-07-2010 at 02:00 PM.

  2. #2
    Join Date
    May 2009
    Posts
    100
    Sorry here are both codes. It sends a blank email? - which is the issues.

    Thanks


    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>SJM Wedding Car Hire, County Down, Northern Ireland</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <link href="style.css" rel="stylesheet" type="text/css" />
    <link href="layout.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body id="page1">
    
    <?php
    $ipi = getenv("REMOTE_ADDR");
    $httprefi = getenv ("HTTP_REFERER");
    $httpagenti = getenv ("HTTP_USER_AGENT");
    ?>
    	<div id="site_center">
    		<div id="main">
    			<!-- header -->
    			<div id="header">
    				<div class="row_1">
    					<div class="indent">
    						<ul class="main_menu">
    							<li><a href="index.html">SJM Wedding Car Hire</a></li>
    							<li class="last"><a href="contact.html">Contact</a></li>
    						</ul>
    					</div>
    				</div>
    				<div class="row_2">
    				</div>
    				<div class="row_3">
    					<img alt="" src="images/slogan.jpg" />
    				</div>
    			</div>
    			<!-- content -->
    			<div id="content">
    				<div class="row_1 bg1">
    					<div class="col_1">
    						<div class="indent">
    							<img class="title" alt="" src="images/1_t1.jpg" />
    							<div class="block">
    								<div class="t">
    									<div class="r">  
    										<div class="l">
    											<div class="l_t">
    												<div class="r_t">
    													<div class="ind">
    														<form id="form1" action="sendmail.php" method="post" enctype="multipart/form-data">
    															<div class="form1 container">
    																<div class="fleft"><strong>Type of service:</strong></div>
    																<div class="fright"><select class="select1" name="carhire"><option>------ please select -------</option><option>Weddding Car Hire</option></select></div>
    																<div class="clear"></div>
    															</div>
    															<div class="form1 container">
    																<div class="fleft"><strong>Vehicle preference:</strong></div>
    																<div class="fright"><select class="select2" name="cars"><option>--- please select ---</option><option>1 Maroon Daimler</option><option>1 Dark Daimler</option><option>2 Daimlers</option></select></div>
    																<div class="clear"></div>
    															</div>
    															<div class="form1 container">
    																<div class="fleft"><strong>Service area:</strong></div>
    																<div class="fright"><select class="select1" name="area"><option>------ please select -------</option><option>County Down</option><option>County Armagh</option><option>Other</option></select></div>
    																<div class="clear"></div>
    															</div>
    															<div class="form1 container">
    																<div class="fleft"><strong>Date of service:</strong></div>
    																<div class="fright"><select class="select3" name="month"><option>month</option><option value="Jan">Jan</option><option value="Feb">Feb</option><option value="Mar">Mar</option><option value="Apr">Apr</option><option value="May">May</option><option value="Jun">Jun</option><option value="Jul">Jul</option><option value="Aug">Aug</option><option value="Sept">Sept</option><option value="Nov">Nov</option><option value="Dec">Dec</option></option></option></option></option></select><select class="select4" name="day"><option>day</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option></select><select class="select5" name="year"><option>year</option><option>2010</option><option>2011</option><option>2012</option><option>2013</option></select></div>
    																<div class="clear"></div>
    															</div>
    															<div class="form1 container">
    															<div class="fleft"><strong>Name:</strong></div>
    															<div class="fright"><input type="text" name="name" /></div>
    																<div class="clear"></div>
    															</div>
    															<div class="form1 container">
    															<div class="fleft"><strong>Telephone:</strong></div>
    															<div class="fright"><input type="text" name="tel" /></div>
    																<div class="clear"></div>
    															</div>
    															<div class="container">
    																<div class="fleft" style="width:101px;">&nbsp;</div>
    																<div class="fleft"><input type="image" src="images/search_but.gif" /></div>
    																<div class="clear"></div>
    															</div>
    														</form>
    													</div>
    												</div>
    											</div>
    										</div>
    									</div>
    								</div>
    							</div>
    						</div>
    					</div>
    					<div class="col_2">
    						<img alt="" src="images/driver.jpg" class="driver"/>
    						<div class="indent">
    							<img class="title" alt="" src="images/1_t2.jpg" /><br />
    							<p class="txt1">Welcome to SJM Limousines. <br />Two Beautiful Daimlers for <br /> Wedding Care Hire In Northern <br /> Ireland..</p>
    							<div class="container">
    								<div class="but">
    									<div class="right">
    										<div class="ind1">
    											<a href="#"><<< Request a Quote Today</a>
    										</div>
    									</div>
    								</div>
    								<div class="clear"></div>
    							</div>
    					  </div>
    					</div>
    					<div class="clear"></div>
    				</div>
    				<div class="row_2 bg2">
    					<div class="col_1">
    						<div class="indent">
    							<div class="container">
    								<div class="column1">
    									<div class="indent">
    										<ul class="list1 line_hor">
    											<li>Spacious and Elegant Daimler Limousines</li>
    											<li>Sparkling Wine</li>
    											<li>Fully Unifromed Drivers</li>
    											<li>A Tailored Service to Suit Your Needs</li>
    											<li>Our High Standards to Give You the Most Luxurious Wedding Day</li>
    										</ul>
    									</div>
    <p>We aim to provide you with a fully tailored service that includes ribbons to suit your special day, fully uniformed drivers and a second Daimler Limousine for your wedding party. We will aim to exceed your expectations providing a luxurious Wedding Car Hire Service in County Down, Armagh and across Northern Ireland. Allowing you to relax and enjoy your great wedding day.</p>
    								</div>
    								<div class="column2">
    									
    								</div>
    								<div class="clear"></div>
    							</div>
    						</div>
    					</div>
    					<div class="col_2">
    						<div class="indent">
    							<h2>About Our Wedding Car Hire Service</h2>
    							<div class="container">
    								<div class="column1"><img alt="" src="images/1_p1.jpg" /></div>
    								<div class="column2">
    									
    <p>Based between Newry and Banbridge, we are offering our elegant and luxurious Daimler Limousines for Wedding Car Hire across Northern Ireland, concentrating our services in the Counties of Down & Armagh although we will take into consideration providing our services further afield. With our service you will be provided top class service with our fully uniformed drivers, sparkling wine and spacious limousines providing plenty of room for the Bride.</p>
    									<a class="link2" href="contact.html"><span>Contact Us</span></a>
    								</div>
    								<div class="clear"></div>
    							</div>
    						</div>
    					</div>
    					<div class="clear"></div>
    				</div>
    			</div>
    			<!-- footer -->
    			<div id="footer">
    				<div class="indent">
    					<div class="fleft">
    						<p>Wedding Car Hire Service with SJM Limousines 4 Ouley Road, Ballinaskeagh,Banbridge, Co. Down. <br /><a href="privacypolicy.html">Privacy Policy</a> </div>
    					<div class="fright">
    						<strong>Call:</strong> 07827018037
    					</div>
    					<div class="clear"></div>
    				</div>
    			</div>
    		</div>
    	</div>	
    </body>
    </html>
    The sendmail.php

    Code:
    <?php
    $name = (isset($_POST["name"])?trim($_POST["name"]):"");
    $tel = (isset($_POST["tel"])?trim($_POST["tel"]):"");
    $carhire = (isset($_POST["carhire"])?trim($_POST["carhire"]):"");
    $cars = (isset($_POST["cars"])?trim($_POST["cars"]):"");
    $area = (isset($_POST["area"])?trim($_POST["area"]):"");
    $month = (isset($_POST["month"])?trim($_POST["month"]):"");
    $day = (isset($_POST["day"])?trim($_POST["day"]):"");
    $year = (isset($_POST["year"])?trim($_POST["year"]):"");
    
    if(!empty($name)||!empty($tel)||!empty($carhire)){
    mail("jimmartin54@live.co.uk", $subj, $msg, "From: $email");
    header("Location: thankyou.html");
    exit;
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Send email</title>
    </head>
    <body>
    <?php
    echo "<h1>Error</h1>\n<p>You did not fill in all fields. Press back on your browser and complete all fields for your <a href=\"http://www.sjmweddingcarhirenorthernireland.co.uk\">wedding car hire quote</a></p>\n";
    ?>
    </body>
    </html>
    Last edited by Nerdygeek; 04-07-2010 at 02:01 PM.

  3. #3
    Join Date
    Sep 2012
    Posts
    1
    Quote Originally Posted by Nerdygeek View Post
    The issue is in the post below.

    Thanks
    Hi Nerdygeek,
    This issue occurs due to some reasons like default url,Subject and contact information get misplaced,hyphen in category name.So always check your form two times and provide full details before posting.

    Thanks.

    ** Links Removed by Site Administrator so it doesn't look like you're spamming. **

  4. #4
    Join Date
    Mar 2011
    Posts
    1,160
    In this case, the problem is that both the submission <form> and the PHP script are incomplete. The form never asks for the user's Email, and the script never incorporates the user's form data into the Email. You need to add an <input> to the form to get the user's Email address, and change the script to something like:
    Code:
    <?php
    $name = (isset($_POST["name"])?trim($_POST["name"]):"");
    $email= (isset($_POST["email"])?trim($_POST["email"]):"");
    $tel = (isset($_POST["tel"])?trim($_POST["tel"]):"");
    $carhire = (isset($_POST["carhire"])?trim($_POST["carhire"]):"");
    $cars = (isset($_POST["cars"])?trim($_POST["cars"]):"");
    $area = (isset($_POST["area"])?trim($_POST["area"]):"");
    $month = (isset($_POST["month"])?trim($_POST["month"]):"");
    $day = (isset($_POST["day"])?trim($_POST["day"]):"");
    $year = (isset($_POST["year"])?trim($_POST["year"]):"");
    
    $msg = '';
    $subj = "Form Submission";
     foreach ($_POST as $key => $value) {
      $msg .= $key . ' = ' . $value . "\n");
     }
    
    if(!empty($name)||!empty($tel)||!empty($carhire)){
    mail("jimmartin54@live.co.uk", $subj, $msg, "From: $email");
    header("Location: thankyou.html");
    exit;
    }
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles