I have a question. I would like to have the information entered on this form sent via email once the user submits the information. The catch is that the email to be sent to, has to use a variable taken from the page itself. For example, the email would have to be something like this:
$domicile@flyapr.com
Since we have 2 different domiciles to where a user belongs to, the email would be tjsj@flyapr.com or kmia@flyapr.com
tjsj or kmia would be decided by $domicile@flyapr.com
Here is the code:
$domicile@flyapr.com
Since we have 2 different domiciles to where a user belongs to, the email would be tjsj@flyapr.com or kmia@flyapr.com
tjsj or kmia would be decided by $domicile@flyapr.com
Here is the code:
Code:
<?php
$ipaddr = getenv(REMOTE_ADDR);
?>
<script language="JavaScript">
<!--
function CalculateHours()
{
var minutes1 = 0;
var minutes2 = 0;
var minutesdelta = 0;
var hours = 0;
var hours2 = '';
minutes1 = document.adminForm.PB_HH.value*60 + document.adminForm.PB_MM.value*1;
minutes2 = document.adminForm.SD_HH.value*60 + document.adminForm.SD_MM.value*1;
if (minutes1 < minutes2) {minutesdelta = minutes2-minutes1}
else {minutesdelta = (minutes2+24*60)-minutes1};
if (document.adminForm.vatsim_flight.value == 'YES') {minutesdelta=minutesdelta*1.5};
hours = (minutesdelta/60)+0.05;
hours2 = ''+hours;
if (hours2.indexOf('.') != -1)
{
hours2=hours2.substring(0,hours2.indexOf('.')+2);
}
//alert ('Test ' + minutesdelta + ' ' + hours2);
document.adminForm.total_block_time.value=hours2;
}
function callJavaScript(functionName)
{
return eval(functionName)
}
//-->
</script>
<script type="text/javascript" src="components/com_philaform/fvalidate/fValidate.config.js"></script>
<script type="text/javascript" src="components/com_philaform/fvalidate/fValidate.core.js"></script>
<script type="text/javascript" src="components/com_philaform/fvalidate/fValidate.lang-enUS.js"></script>
<script type="text/javascript" src="components/com_philaform/fvalidate/fValidate.validators.js"></script>
<style>
input.errHilite, select.errHilite, textarea.errHilite {
border: 1px solid #DDC;
background-color: #FFE;
}
label.errHilite {
color: #C00;
}
ul#errors {
display: none;
margin-top: 1em;
background-color: #FFE;
border: 1px solid #CC9;
padding: .3em;
color: #C00;
font-weight: bold;
}
ul#errors li {
margin-top: .5em;
margin-bottom: .5em;
padding: 0;
}
ul#errors li.heading {
list-style-type: none;
color: #000;
font-weight: normal;
font-style: italic;
margin: .5em 0;
padding: 0;
}
</style>
<ul id="errors">
</ul>
<div class="contentheading"></div>
<form method="post" action="index.php" name="adminForm" id="adminForm" enctype="multipart/form-data" onsubmit="return validateForm( this, false, true, false, true, 28 );">
<div class="componentheading">Submit FREP</div>
<table border="0">
<tbody>
<tr>
<td> </td>
<td><font color="red" size="5">·</font> = Required</td>
</tr>
<tr>
<td><font color="red" size="5">·</font>Date Flown</td>
<td>
<input paf="blank" emsg="" type="text" class="inputbox" name="date_flown" id="date_flown" size="9" value="click here -->">
<script type="text/javascript" src="includes/js/mambojavascript.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="includes/js/calendar/calendar-mos.css" title="green" />
<script type="text/javascript" src="includes/js/calendar/calendar.js"></script>
<script type="text/javascript" src="includes/js/calendar/lang/calendar-en.js"></script>
<input name="reset" type="reset" class="button" onClick="return showCalendar('date_flown');" value="...">
</td>
</tr>
<tr>
<td><font color="red" size="5">·</font>Flight Number</td>
<td><input type="text" paf="alnum|4|U|true|false|none" emsg="" alt="" class="inputbox" name="flight_number" size="9" maxlength="6" value="">
<font size="1">(ex. AP2732)</font>
</td>
</tr>
<tr>
<td><font color="red" size="5">·</font>VATSIM Flight</td>
<td><select size="1" paf="select" emsg="" class="inputbox" name="vatsim_flight" onChange="Javascript:CalculateHours();" >
<option value="" SELECTED> </option>
<option value="YES">Yes</option>
<option value="NO">No</option>
</select>
</td>
</tr>
<tr>
<td><font color="red" size="5">·</font>Aircraft Used</td>
<td><select size="1" paf="select" emsg="" class="inputbox" name="aircraft_used" >
<option value="" SELECTED> </option>
<option value="Aerospatiale 350">Aerospatiale 350</option>
<option value="Aerospatiale ATR 42-500">Aerospatiale ATR 42-500</option>
<option value="Aerospatiale ATR 72-500">Aerospatiale ATR 72-500</option>
<option value="Airbus 300-600R">Airbus 300-600R</option>
<option value="Airbus 320-211">Airbus 320-211</option>
<option value="Airbus 330-200">Airbus 330-200</option>
<option value="Airbus 340-300">Airbus 340-300</option>
<option value="Beechcraft 1900D">Beechcraft 1900D</option>
<option value="Bell 430">Bell 430</option>
<option value="Boeing 727-200">Boeing 727-200</option>
<option value="Boeing 737-700">Boeing 737-700</option>
<option value="Boeing 737-800">Boeing 737-800</option>
<option value="Boeing 747-200">Boeing 747-200</option>
<option value="Boeing 757-200">Boeing 757-200</option>
<option value="Boeing 767-200">Boeing 767-200</option>
<option value="Boeing 767-300">Boeing 767-300</option>
<option value="Boeing 777-200">Boeing 777-200</option>
<option value="Boeing 787-800">Boeing 787-800</option>
<option value="Bombardier CRJ-200">Bombardier CRJ-200</option>
<option value="Cessna 310">Cessna 310</option>
<option value="Cessna Caranedo Centurion">Cessna Caranedo Centurion</option>
<option value="Cessna Citation X">Cessna Citation X</option>
<option value="Cessna Conquest II">Cessna Conquest II</option>
<option value="Embraer 120">Embraer 120</option>
<option value="Embraer 170">Embraer 170</option>
<option value="Eurocopter EC135">Eurocopter EC135</option>
<option value="McDonnell Douglas DC-3">McDonnell Douglas DC-3</option>
<option value="McDonnell Douglas DC-8-73">McDonnell Douglas DC-8-73</option>
<option value="McDonnell Douglas DC-10">McDonnell Douglas DC-10</option>
<option value="McDonnell Douglas MD-83">McDonnell Douglas MD-83</option>
<option value="Other aircraft">Other aircraft</option>
</select>
</td>
</tr>
<tr>
<td><font color="red" size="5">·</font>Departure Airport</td>
<td><input type="text" paf="alnum|4|U|false|false|none" emsg="" alt="" class="inputbox" name="departure_airport" size="9" maxlength="4" value="">
<font size="1">(ICAO Code ex: KJFK)</font>
</td>
</tr>
<tr>
<td><font color="red" size="5">·</font>Arrival Airport</td>
<td><input type="text" paf="alnum|4|U|false|false|none" emsg="" alt="" class="inputbox" name="arrival_airport" size="9" maxlength="4" value="">
<font size="1">(ICAO Code ex: TJSJ)</font>
</td>
</tr>
<tr><td><font color="red" size="5">·</font>Pushback Time</td>
<td><select size="1" paf="select" emsg="" class="inputbox" name="PB_HH" onChange="Javascript:CalculateHours();" >
<option value="" SELECTED> </option>
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</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>
</select>
: <select size="1" paf="select" emsg="" class="inputbox" name="PB_MM" onChange="Javascript:CalculateHours();" >
<option value="" SELECTED> </option>
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</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>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
</select>
<font size="1">Z</font><br />
</td>
</tr>
<tr>
<td><font color="red" size="5">·</font>Shutdown Time</td>
<td><select size="1" paf="select" emsg="" class="inputbox" name="SD_HH" onChange="Javascript:CalculateHours();" >
<option value="" SELECTED> </option>
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</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>
</select>
: <select size="1" paf="select" emsg="" class="inputbox" name="SD_MM" onChange="Javascript:CalculateHours();" >
<option value="" SELECTED> </option>
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</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>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
<option value="58">58</option>
<option value="59">59</option>
</select>
<font size="1">Z</font>
</td>
</tr>
<tr>
<td><font color="red" size="5">·</font>Total Block Time</td>
<td><input type="text" readonly="readonly" paf="" emsg="" alt="" class="inputbox" name="total_block_time" size="9" maxlength="4" value=""><font size="1"> hrs</font>
</td>
</tr>
<tr>
<td><font color="red" size="5">·</font>Distance Flown</td>
<td><input type="text" paf="numeric|2" emsg="" alt="" class="inputbox" name="distance" size="9" maxlength="8" value=""><font size="1"> nm (NO DECIMALS and NO COMMAS)</font></td>
</tr>
<tr>
<td><font color="red" size="5">·</font>Fuel Used</td>
<td><input type="text" paf="numeric|3" emsg="" alt="" class="inputbox" name="fuel" size="9" maxlength="6" value=""><font size="1"> lbs (NO DECIMALS and NO COMMAS)</font></td>
</tr>
<tr>
<td>Comments</td>
<td><textarea paf="" emsg="" class="inputbox" name="comments" cols="50" rows="5" ></textarea>
</td>
</tr>
<tr>
<td> </td>
<td><input type="hidden" name="adminForm_philaform_sent" value="1">
<input type="submit" name="doit" id="doit" class="button" value="Send FREP" >
<input type="reset" name="reset" class="button" value="Reset">
</td>
</tr>
</tbody>
</table>
<?php
$query = "SELECT name FROM #__users WHERE id = " . $my->id;
$database->setQuery($query);
echo "<input type=\"hidden\" name=\"username\" value=\"" .$database->loadResult() . "\">\n";
?>
<?php
$query = "SELECT email FROM #__users WHERE id = " . $my->id;
$database->setQuery($query);
echo "<input type=\"hidden\" name=\"email\" value=\"" .$database->loadResult() . "\">\n";
?>
<?php
$query = "SELECT cb_pilotid FROM #__comprofiler WHERE id = " . $my->id;
$database->setQuery($query);
echo "<input type=\"hidden\" name=\"pilot_id\" value=\"" .$database->loadResult() . "\">\n";
?>
<?php
$query = "SELECT cb_domicile FROM #__comprofiler WHERE id = " . $my->id;
$database->setQuery($query);
echo "<input type=\"hidden\" name=\"domicile\" value=\"" .$database->loadResult() . "\">\n";
?>
<?php
$query = "SELECT cb_division FROM #__comprofiler WHERE id = " . $my->id;
$database->setQuery($query);
echo "<input type=\"hidden\" name=\"division\" value=\"" .$database->loadResult() . "\">\n";
?>
<input type="hidden" name="ipaddress" value="<?php echo $ipaddr; ?>">
<input type="hidden" name="formtitle" value="">
<input type="hidden" name="form_id" value="1">
<?php
$timestamp = time();
echo "<input type=\"hidden\" name=\"TIMESTAMP\" value=\"" . date("Y-m-d",$timestamp) . "\">\n";
?>
<input type="hidden" name="option" value="com_philaform">
<input type="hidden" name="Itemid" value="62">
<input type="hidden" name="formname" value="adminForm">
</form>