This is form that i want to submit and send a mail to my email i have used some codes for that and it doesn't work

<form id="F2" name="F2" method="post" action="contact/send_contact.php" onsubmit="return validateForm(this)">
         <div id="hedding"> <h2>Contact Details</h2>
               </div>
               <P><center><?php 
			   error_reporting(0);
			   include("init/db.php");
			   $table=$_GET['hotel'];
			   $id=$_GET['id'];			   
			   $sql = "SELECT * FROM $table WHERE id=$id";
			   $result=mysql_query($sql);  


  while($info=mysql_fetch_array($result)){
	 $name=$info['name'];
	  echo '<h3>'.$name.'</h3><input name="hotelname" type="hidden" id="hotelname" value=" '.$name.'" /> ';
	  }

			   
			   ?></center></P>
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td><table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tbody>
                      <tr>
                        <td width="24%"> Name* :</td>
                        <td align="left" width="76%"><input name="name" id="name" size="70" type="text" /></td>
                      </tr>
                    </tbody>
                    </table></td>
                </tr>
              </tbody>
            </table>
            <table cellpadding="0" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td colspan="4" height="6"></td>
                </tr>
                <tr>
                  <td align="left" valign="middle" width="24%">Phone Number* :</td>
                  <td align="left" valign="middle" width="36%"><input name="phone" id="phone" size="15" maxlength="20" type="text" /></td>
                  <td align="left" valign="middle" width="14%">Home :</td>
                  <td align="left" valign="middle" width="26%"><input name="home" id="home" size="15" maxlength="20" type="text" /></td>
                </tr>
                <tr>
                  <td colspan="4" align="left" valign="middle" height="6"></td>
                </tr>
                <tr>
                  <td align="left" valign="middle">E-mail * :</td>
                  <td align="left" valign="middle"><input name="email" id="email" size="40" type="text" /></td>
                  <td align="left" valign="middle"></td>
                  <td align="left" valign="middle"></td>
                </tr>
                <tr>
                  <td colspan="4" align="left" valign="middle" height="6"></td>
                </tr>
                <tr>
                  <td align="left" valign="middle">Fax number :</td>
                  <td align="left" valign="middle"><input name="fax" id="txtFax2 " size="15" maxlength="20" type="text" /></td>
                  <td align="left" valign="middle"></td>
                  <td align="left" valign="middle"></td>
                </tr>
                <tr>
                  <td align="left" valign="middle" height="6">Country of Residence</td>
                  <td align="left" valign="middle"><select name="country" id="country">
                    <option value="" selected="selected">-------------Choose One-------------</option>
                    <option value="Sri Lanka ">Sri Lanka </option>
                    <option value="Afghanistan">Afghanistan </option>
                    <option value="Albania">Albania </option>
                    <option value="Algeria">Algeria </option>
                    <option value="Andorra">Andorra </option>
                    <option value="Angola">Angola </option>
                    <option value="Anguilla">Anguilla </option>
                    <option value="Antarctica">Antarctica </option>
                    <option value="Antigua &amp; Barbudo">Antigua &amp; Barbudo </option>
                   
                    <option value="Zambia ">Zambia </option>
                    <option value="Zimbabwe">Zimbabwe</option>
                    </select></td>
                  <td align="left" valign="middle"></td>
                  <td align="left" valign="middle"></td>
                </tr>
              </tbody>
            </table>
            <h2>General Information</h2>
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td>Number of Travellers</td>
                </tr>
              </tbody>
            </table>
            <div>
              Adult :
              
                <input name="adults" id="adults" size="5" maxlength="5" type="text" />
                
              Children below 12 years:
              
                <input name="chidb" id="chidb" size="5" maxlength="5" type="text" />
               
              Infants below 3 years:
             
                <input name="below" id="below" size="5" maxlength="5" type="text" />
                
            </div>
            <br />
            <br />
            <div id="hedding">
              <h2>Accomodation</h2>
            </div>
            <div>
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                  <tr>
                    <td align="left" valign="middle" width="10%">Standard :</td>
                    <td align="left" valign="middle" width="3%"><input name="standed" id="standed" value="Standard" type="checkbox" /></td>
                    <td align="left" valign="middle" width="17%">yes</td>
                    <td align="left" valign="middle" width="29%"><table border="0" cellpadding="0" cellspacing="0" width="67%">
                      <tbody>
                        <tr>
                          <td width="73%">Budget</td>
                          <td width="11%"><input name="budget" id="budget" type="checkbox" value="Budget" /></td>
                          <td width="16%">yes</td>
                        </tr>
                      </tbody>
                      </table></td>
                    <td align="left" valign="middle" width="14%">Deluxe:</td>
                    <td align="left" valign="middle" width="3%"><input name="deluxe" id="deluxe" type="checkbox" value="Deluxe"  /></td>
                    <td align="left" valign="middle" width="7%">yes </td>
                    <td align="left" valign="middle" width="17%"> </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div>
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                  <tr>
                    <td align="left" valign="middle" width="22%">Hotel Category</td>
                    <td colspan="3" align="left" valign="middle"><select name="hotel" id="hotel">
                      <option>3 Stars</option>
                      <option>4 Stars</option>
                      <option>5 Stars</option>
                      <option>Boutique</option>
                    </select></td>
                    <td align="left" valign="middle" width="1%"> </td>
                    <td align="left" valign="middle" width="17%"> </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div>
              <h3>How many rooms do you require?</h3>
            </div>
            <div>
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                  <tr>
                    <td align="left" valign="middle" width="23%">Single Rooms :</td>
                    <td align="left" valign="middle" width="13%"><select name="sroom" id="sroom">
                      <option selected="selected">none</option>
                      <option>01</option>
                      <option>02</option>
                      <option>03</option>
                      <option>04</option>
                      <option>05</option>
                    
                    </select></td>
                    <td align="left" valign="middle" width="18%">Double Rooms:</td>
                    <td align="left" valign="middle" width="13%"><select name="droom" id="select2">
                      <option selected="selected">none</option>
                      <option>01</option>
                      <option>02</option>
                      <option>03</option>
                      <option>04</option>
                      <option>05</option>
                 
                      <option>30</option>
                    </select></td>
                    <td align="left" valign="middle" width="16%">Triple Rooms :</td>
                    <td align="left" valign="middle" width="17%"><select name="troom" id="select3">
                      <option selected="selected">none</option>
                      <option>01</option>
                      <option>02</option>
                      <option>03</option>
                      <option>04</option>
                      <option>05</option>
                  
                    </select></td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div> </div>
            <div  id="hedding">
              <h2>Holiday Dates</h2>
            </div>
            <div>
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                  <tr>
                    <td width="14%">From-</td>
                    <td width="39%"><input name="from" id="from" onfocus="this.select();lcs(this)" onclick="event.cancelBubble=true;this.select();lcs(this)" value="dd/mm/yy" size="16" type="text" /></td>
                    <td width="4%">To</td>
                    <td width="43%"><input name="to" id="to" onfocus="this.select();lcs(this)" onclick="event.cancelBubble=true;this.select();lcs(this)" value="dd/mm/yy" size="16" type="text" /></td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div> </div>
            <div  id="hedding">
              <h2>Holiday Type</h2>
            </div>
            <div>
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                  <tr>
                    <td> </td>
                  </tr>
                  <tr>
                    <td><select name="holiday_type" id="holiday_type">
                      <option selected="selected" value="">Select Holiday Type</option>
                      <option value="Excursion Tour">Excursion Tour</option>
                      <option value="Beach Holiday">Beach Holiday</option>
                      <option value="Beach Holiday &amp; Excursion Tour">Beach Holiday &amp; Excursion Tour</option>
                      </select></td>
                  </tr>
                  <tr>
                    <td> </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div  id="hedding">
              <h2>Select you Package</h2>
            </div>
            <div>
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                  <tr>
                    <td colspan="7" align="left" valign="middle" height="6"></td>
                  </tr>
                  <tr>
                    <td colspan="6" align="left" valign="middle">How may we assist you?
                      
                        <select name="assist" id="assist">
                          <option>Arrange your Holiday</option>
                          <option>Arrange your Wedding</option>
                          <option>Arrange your Honey Moon</option>
                          <option>Arrange an Incentive</option>
                          <option>Arrange a Conference</option>
                        </select>
                      
                    </td>
                  </tr>
                  <tr>
                    <td colspan="7" align="left" valign="middle" height="10"></td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div  id="hedding">
              <h2> Interests
                <input name="int" id="int"  checked="checked" type="checkbox" />
                yes</h2>
            </div>
            <table id="inttb" name="inttb" border="0" cellpadding="0" cellspacing="0" width="99%">
              <tbody>
                <tr>
                  <td width="22%"> </td>
                  <td width="6%"> </td>
                  <td width="13%"> </td>
                  <td width="12%"> </td>
                  <td width="12%"><strong>Transfer by</strong></td>
                  <td width="32%"> </td>
                  <td width="3%"> </td>
                </tr>
                <tr>
                  <td>Beach </td>
                  <td width="6%"><input name="beach" type="checkbox" id="beach" value="<li>Beach</li>" onclick="TotalCheckedValues()" /></td>
                  <td width="13%">Excursion</td>
                  <td width="12%"><input name="excursion" id="excursion" type="checkbox"  value="<li>Excursion</li>" onclick="TotalCheckedValues()"/></td>
                  <td> </td>
                  <td> 
                    <label>
                      <input type="hidden" name="inter" id="inter" />
                  </label></td>
                  <td> </td>
                </tr>
                <tr>
                  <td><div align="left">Wildlife/Nature</div></td>
                  <td><input name="wild" id="wild" value="<li>Wildlife/Nature</li> " type="checkbox" onclick="TotalCheckedValues()" /></td>
                  <td><div align="left">River Rafting</div></td>
                  <td><input name="river" id="river" value="<li>River Rafting</li>" type="checkbox" onclick="TotalCheckedValues()"/></td>
                  <td>Car</td>
                  <td><input name="car" id="car" type="checkbox" onclick="TotalCheckedValues()" value="<li>Car</li>"/></td>
                  <td> </td>
                </tr>
                <tr>
                  <td><div align="left">Bird Watching</div></td>
                  <td><input name="bird" id="bird" value="<li>Bird Watching</li>" type="checkbox" onclick="TotalCheckedValues()"/></td>
                  <td><div align="left">Fishing</div></td>
                  <td><input name="fish" id="fish" value="<li>Fishing</li>" type="checkbox" onclick="TotalCheckedValues()"/></td>
                  <td>Micro</td>
                  <td><input name="micro" id="micro" type="checkbox" onclick="TotalCheckedValues()" value="<li>Micro</li>"/></td>
                  <td> </td>
                </tr>
                <tr>
                  <td><div align="left">Water sports </div></td>
                  <td><input name="water" id="water" value="<li>Water sports</li>" type="checkbox" onclick="TotalCheckedValues()"/></td>
                  <td><div align="left">Golf Tours </div></td>
                  <td><input name="golf" id="golf" value="<li>Golf Tours</li>" type="checkbox" onclick="TotalCheckedValues()"/></td>
                  <td>Coach</td>
                  <td><input name="coach" id="coach" type="checkbox" onclick="TotalCheckedValues()" value="<li>Coach</li>"/></td>
                  <td> </td>
                </tr>
                <tr>
                  <td><div align="left">Night Life</div></td>
                  <td><input name="night" id="night" value="<li>Night Life</li>" type="checkbox" onclick="TotalCheckedValues()"/></td>
                  <td><div align="left">Shopping</div></td>
                  <td><input name="shoping" id="shoping" value="<li>Shopping</li>" type="checkbox" onclick="TotalCheckedValues()"/></td>
                  <td>Helicopter</td>
                  <td><input name="heli" id="heli" type="checkbox" onclick="TotalCheckedValues()" value="<li>Helicopter</li>"/></td>
                  <td> </td>
                </tr>
                <tr>
                  <td> </td>
                  <td> </td>
                  <td> </td>
                  <td> </td>
                  <td colspan="2"> </td>
                  <td> </td>
                </tr>
              </tbody>
            </table>
            <table border="0" cellpadding="0" cellspacing="0" width="100%">
              <tbody>
                <tr>
                  <td align="left" valign="top">Special Remarks</td>
                  <td colspan="6" align="left" valign="top"><textarea name="spre" cols="70" rows="3" id="spre"></textarea></td>
                </tr>
              </tbody>
            </table>
            <!--   <div class="Traveller">  	<h3>Any special requests or indications?	</h3>  </div>  <div class="Traveller">    <textarea name="txtComm" cols="100" rows="5" class="style23 BorderFitter" id="txtComm" style="float:right;"></textarea>	  </div>-->
            <div>
              <table border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                  <tr>
                    <td colspan="5" align="left" valign="middle">If you require the service of a professional guide, indicate preferred language :</td>
                    <td align="left" valign="middle"><select name="guid" id="guid">
                      <option>English</option>
                      <option>German</option>
                      <option>French</option>
                      <option>Italian</option>
                      <option>Japanese</option>
                    </select></td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div> 
              <p>Please submit your request, our supporting will contact you via email shortly. Thank You  </p>
              <p>
               <center> <input name="Submit" value="Submit" type="submit" /></center>
              </p>
            </div>
        </form>
<?php

$name = $_POST['name'];
$phone = $_POST['phone'];
$home = $_POST['home'];
$email = $_POST['email'];
$fax = $_POST['fax'];
$country = $_POST['country'];
$adults = $_POST['adults'];
$chidb = $_POST['chidb'];
$below = $_POST['below'];
$standed = $_POST['standed'];
$budget = $_POST['budget'];
$deluxe = $_POST['deluxe'];
$hotel = $_POST['hotel'];
$sroom = $_POST['sroom'];
$droom = $_POST['droom'];
$troom = $_POST['troom'];
$from = $_POST['from'];
$to = $_POST['to'];
$holiday_type = $_POST['holiday_type'];
$assist = $_POST['assist'];
$spre = $_POST['spre'];
$guid = $_POST['guid'];
$inter = $_POST['inter'];
$hotelname = $_POST['hotelname'];
$tp = $_POST['tp'];

$details = '
    Tour Packege:
    Hotel : '.$hotelname.'
	Name : '.$name.'
    Phone :'.$phone.'
    Home : '.$home.'

 Email : '.$email.'
 Fax : '.$fax.'
 Country : '.$country.'
Adult : '.$adults.'
Child :'.$chidb.'
Below :'.$below.'
Hotel Type : '.$standed . $budget . $deluxe.' | '.$hotel.'
Rooms :
    | Small |'.$sroom.'| Double | '.$droom.' | Triple |'.$troom.'
    Frm    : '.$from.'
	To :'.$to.'
 
    Holiday Type : '.$holiday_type.'
    How may we assist you? : '.$assist.'
    Interests : 
 
   <ul>
      '.$inter.'
    </ul>
	
	Special Remarks : '.$spre.'
    preferred language : '.$guid.'.';







$subject="Tour Booking";
$detail=$details;
$name="Website";
$customer_mail=$email;

// Contact subject
$subject ="$subject";
// Details
$message="$detail";

// Mail of sender
$mail_from="Tour Booking - "."$customer_mail";
// From
$header="from: $name <$mail_from>";

// Enter your email address
$to ='ruwanaru_weerasingha@live.com';

$send_contact=mail($to,$subject,$message,$header);

// Check, if message sent to your email
// display message "We've recived your information"
if($send_contact){
echo "We've recived your contact information";
}
else {
echo "ERROR";
}
?>

Are you always getting "ERROR" when you submit the form? If yes, then try changing $header="from: $name <$mail_from>"; to:

$header="From: " . $mail_from . PHP_EOL;
$header="To: " . $to.PHP_EOL;

If you are NOT seeing "ERROR", then check your spam folder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.