Angel Air Posted April 7, 2015 Report Posted April 7, 2015 Hi all I have created this form to place in the pilot centre so that if a pilot would like a route added to the VA he/she can fill this in and send it to the schedules manager. I have built the front end but I am struggling with the back end (PHP) could someone help me out? <!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=utf-8" /> <form name="contactform" method="post" action="send_form_email.php"> <table width='100%' border='0'> <tr> <td><strong>Name:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname.'" />'; } else { ?> <input type="text" name="name" value="" /> <?php } ?> </td> </tr> <tr> <td width="1%" nowrap><strong>E-Mail Address:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->email; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->email.'" />'; } else { ?> <input type="text" name="email" value="" /> <?php } ?> </td> </tr> <tr> <td><strong>Departure ICAO: </strong></td> <td><input type="text" name="subject" value="<?php echo $_POST['departure icao'];?>" /></td> </tr> <tr> <td><strong>Arrival ICAO: </strong></td> <td><input type="text" name="subject" value="<?php echo $_POST['arrival icao'];?>" /></td> </tr> <tr> <td><strong>Route:</strong></td> <td> <textarea name="message" cols='45' rows='5'><?php echo $_POST['message'];?></textarea> </td> </tr> <tr> <td><strong>Aircraft:</strong></td> <td> PREFERRED AIRCRAFT:<br /> <select name="Aircraft"> <option value=" ">Please choose one</option> <option value=" ">Airbus</option> <option>Airbus A318-111</option> <option>Airbus A319-111</option> <option>Airbus A320-211</option> <option>Airbus A321-211</option> <option value=" ">Boeing</option> <option>Boeing 737-800/W</option> <option>Boeing 737-900/W</option> <option>Boeing 747-400</option> <option>Boeing 747-400F</option> <option>Boeing 747-800I</option> <option>Boeing 757-200</option> <option>Boeing 767-300</option> <option>Boeing 777-200LR</option> <option>Boeing 777-300ER</option> <option>Boeing 777-200F</option> <option value=" ">De Havilland</option> <option>DHC-8-400</option> <option value=" ">McDonnell Douglas</option> <option>MD-11</option> <option>MD-11F</option> </select><br /><br /> </td> </tr> <tr> <td><strong>Flight Level: </strong></td> <td><input type="text" name="subject" value="" /></td> </tr> <tr> <td><strong>Departure Time: </strong></td> <td><input type="text" name="subject" value="" /></td> </tr> <tr> <td><strong>Arrival Time: </strong></td> <td><input type="text" name="subject" value="" /></td> </tr> <tr> <td><strong>Flight Time: </strong></td> <td><input type="text" name="subject" value="" /></td> </tr> <tr> <td><strong>Notes: </strong></td> <td> <textarea name="message" cols='45' rows='5'><?php echo $_POST['message'];?></textarea> </td> </tr> <tr> <td width="1%" nowrap><strong>Captcha</strong></td> <td> <?php echo recaptcha_get_html(Config::Get('RECAPTCHA_PUBLIC_KEY'), $captcha_error); ?> </td> </tr> <tr> <td><strong>Price Per Ticket: £ </strong></td> <td><input type="text" name="subject" value="" /></td> </tr> <tr> <td><strong>Flight Type "P"= Passenger "C"= Cargo: </strong></td> <td><input type="text" name="subject" value="" /></td> </tr> <tr> <td><strong>Days of the week this schedule is active 7 = everyday</strong></td> <td><input type="text" name="subject" value="" /></td> </tr> <tr> <td colspan="2" style="text-align:center"> <input type="submit" value="Submit"> </td> </tr> </table> </form> Quote
Members Vangelis Posted April 7, 2015 Members Report Posted April 7, 2015 Do you want it to automaticly add the schedule to the database and make it flyable ? or do you want first to be accepted by an admin ? Quote
Angel Air Posted April 7, 2015 Author Report Posted April 7, 2015 I did not think you could just add it straight to the schedules Quote
Angel Air Posted April 7, 2015 Author Report Posted April 7, 2015 Here is what I have got so far route_submit.tpl to go in core/templates <form action="route_submit.php" method="POST"> <table width='100%' border='0'> <tr> <td><strong>Name:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->firstname .' '.Auth::$userinfo->lastname.'" />'; } else { ?> <input type="text" name="name" value="" /> <?php } ?> </td> </tr> <tr> <td width="1%" nowrap><strong>E-Mail Address:</strong></td> <td> <?php if(Auth::LoggedIn()) { echo Auth::$userinfo->email; echo '<input type="hidden" name="name" value="'.Auth::$userinfo->email.'" />'; } else { ?> <input type="text" name="email" value="" /> <?php } ?> </td> </tr> <tr> <td><strong>Departure ICAO: </strong></td> <td><input type="text" name="depp"></td> </tr> <tr> <td><strong>Arrival ICAO: </strong></td> <td><input type="text" name="arr"></td> </tr> <tr> <td><strong>Route:</strong></td> <td> <textarea name="route" cols='45' rows='5'><?php echo $_POST['message'];?></textarea> </td> </tr> <tr> <td><strong>Aircraft:</strong></td> <td> PREFERRED AIRCRAFT:<br /> <select name="Aircraft"> <option value=" ">Please choose one</option> <option value=" ">Airbus</option> <option>Airbus A318-111</option> <option>Airbus A319-111</option> <option>Airbus A320-211</option> <option>Airbus A321-211</option> <option value=" ">Boeing</option> <option>Boeing 737-800/W</option> <option>Boeing 737-900/W</option> <option>Boeing 747-400</option> <option>Boeing 747-400F</option> <option>Boeing 747-800I</option> <option>Boeing 757-200</option> <option>Boeing 767-300</option> <option>Boeing 777-200LR</option> <option>Boeing 777-300ER</option> <option>Boeing 777-200F</option> <option value=" ">De Havilland</option> <option>DHC-8-400</option> <option value=" ">McDonnell Douglas</option> <option>MD-11</option> <option>MD-11F</option> </select><br /><br /> </td> </tr> <tr> <td><strong>Flight Level: </strong></td> <td><input type="text" name="fl"></td> </tr> <tr> <td><strong>Departure Time: </strong></td> <td><input type="text" name="dtime"></td> </tr> <tr> <td><strong>Arrival Time: </strong></td> <td><input type="text" name="atime"></td> </tr> <tr> <td><strong>Flight Time: </strong></td> <td><input type="text" name="ftime"></td> </tr> <tr> <td><strong>Notes: </strong></td> <td> <textarea name="notes" cols='45' rows='5'><?php echo $_POST['notes'];?></textarea> </td> </tr> <tr> <td><strong>Price Per Ticket: £ </strong></td> <td><input type="text" name="ppt"></td> </tr> <tr> <td><strong>Flight Type "P"= Passenger "C"= Cargo: </strong></td> <td><input type="text" name="flight type"></td> </tr> <tr> <td><strong>Days of the week this schedule is active 7 = everyday</strong></td> <td><input type="text" name="dow"></td> </tr> <tr> <td width="1%" nowrap><strong>Captcha</strong></td> <td> <?php echo recaptcha_get_html(Config::Get('RECAPTCHA_PUBLIC_KEY'), $captcha_error); ?> </td> </tr> <tr> <td> <input type="hidden" name="loggedin" value="<?php echo (Auth::LoggedIn())?'true':'false'?>" /> </td> <td> <input type="submit" name="submit" value='Submit Route'> </td> </tr> </table> </form> and route_submit.php to go in core/modules <?php $name = $_POST['name']; $email = $_POST['email']; $depp = $_POST['depp']; $arr = $_POST['arr']; $route = $_POST['route']; $aircraft = $_POST['aircraft']; $fl = $_POST['fl']; $dtime = $_POST['dtime']; $atime = $_POST['atime']; $ftime = $_POST['ftime']; $notes = $_POST['notes']; $formcontent="From: $name \n Depp: $depp \n Arr: $arr \n Route: $route \n Aircraft: $aircraft \n Fl: $fl \n Dtime: $dtime \n Atime: $atime \n Ftime: $ftime \n Notes: $notes \n"; $recipient = "schedulesmanager@angelairva.co.uk"; $subject = "Pilot Submitted Route"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" . " -" . "<a href='form.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>"; ?> I have just tried it and i get An Error Was Encountered The module "ROUTE_SUBMIT" doesn't exist! Quote
Members Vangelis Posted April 8, 2015 Members Report Posted April 8, 2015 Because it would take a lot of time to explain how MVC programing works here is your module if you want to do some changes i would sugest to have a look on how it is constructed if you have any questions post them here . Just put the folders into their location and call the module by linking to www.yoursite..com/index.php/RouteSubmit for your info with the same way you can also add make a query to add it directly to the database Module.zip Quote
Angel Air Posted April 8, 2015 Author Report Posted April 8, 2015 Because it would take a lot of time to explain how MVC programing works here is your module if you want to do some changes i would sugest to have a look on how it is constructed if you have any questions post them here . Just put the folders into their location and call the module by linking to www.yoursite..com/index.php/RouteSubmit for your info with the same way you can also add make a query to add it directly to the database Thankyou very much. That is very kind of you to do that for me. I have read the pinned post about modules and MVC but I have not done enough coding for it to make sense to me I will look at it and try to understand it a bit better than I do at the moment. Thanks once again Quote
Members Vangelis Posted April 8, 2015 Members Report Posted April 8, 2015 You all need to change the email recipient because i forgot my email in it so i am getting your emails go to core/modules/RouteSubmit.php and change the email Quote
Angel Air Posted April 8, 2015 Author Report Posted April 8, 2015 Thanks for the help Vangelis. I have inserted the files into the respective folders but I am now getting this error, Notice: The template file "/home/angelai2/public_html//core/templates/RouteSubmit/RouteSubmit.tpl" doesn't exist in/home/angelai2/public_html/core/classes/TemplateSet.class.php on line 248 Quote
Angel Air Posted April 8, 2015 Author Report Posted April 8, 2015 nevermind a folder did not upload correctly Thankyou again for all your help Quote
Angello Posted April 10, 2015 Report Posted April 10, 2015 Thank You! - Return Home when you click on Return Home This error appears Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'RouteSubmit::form.html' was given in/membri/wwwcubanavirtual/phpvms/core/classes/MainController.class.php on line 218 Good Excellent work, thank you very much for the contribution Quote
Angel Air Posted April 10, 2015 Author Report Posted April 10, 2015 Thank You! - Return Home when you click on Return Home This error appears Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'RouteSubmit::form.html' was given in/membri/wwwcubanavirtual/phpvms/core/classes/MainController.class.php on line 218 Good Excellent work, thank you very much for the contribution Change the last line of code to look like this in the core/modules/Routsubmit/Routesubmit.php echo "Thank You!" . " -" . "<a href='http://YOUR SITE' style='text-decoration:none;color:#ff0099;'> Return Home</a>"; 1 Quote
Angel Air Posted April 11, 2015 Author Report Posted April 11, 2015 I am having a problem with the select aircraft section it is not showing up on the email so my schedules manager has no idea which aircraft the pilot wanted to use on the flight any ideas? Quote
Angello Posted April 13, 2015 Report Posted April 13, 2015 Angel Air echo "Thank You!" . " -" . "<a href='http://YOUR SITE' style='text-decoration:none;color:#ff0099;'> Return Home</a>"; Thank you. works perfectly, good job Quote
Angel Air Posted April 15, 2015 Author Report Posted April 15, 2015 Vangelis Could you take a look at the code to see why when I select the aircraft to be used it does not get sent in the email even though it has been selected in the form. Thanks in advance Scott Quote
Angello Posted April 15, 2015 Report Posted April 15, 2015 the aircraft selected on the form, does not appear in the data received in the mail tanks Quote
Members Vangelis Posted April 16, 2015 Members Report Posted April 16, 2015 New Version including the full name of the aircraft Do not forget to put your email and website address in core\modules\RouteSubmit\RouteSubmit.php core.zip Quote
Angello Posted April 16, 2015 Report Posted April 16, 2015 Vangelis Functions properly, good job thank you Quote
Angel Air Posted April 16, 2015 Author Report Posted April 16, 2015 Thankyou Vangelis Now testing Quote
Angello Posted April 16, 2015 Report Posted April 16, 2015 Vangelis I have already proved it, it works correctly, You can see in the image tanks Quote
IrfanKhan Posted April 20, 2015 Report Posted April 20, 2015 i am using simpilot 5.5x not working for me giving below error any help will be appreciated Fatal error: Call to undefined function recaptcha_get_html() in /home/pakvacc1/public_html/PIA/lib/skins/vp/RouteSubmit/RouteSubmit.php on line 136 on line 136 <?php echo recaptcha_get_html(Config::Get('RECAPTCHA_PUBLIC_KEY'), $captcha_error); ?> Quote
FSX30HD Posted April 30, 2015 Report Posted April 30, 2015 i am using simpilot 5.5x not working for me giving below error any help will be appreciatedFatal error: Call to undefined function recaptcha_get_html() in /home/pakvacc1/public_html/PIA/lib/skins/vp/RouteSubmit/RouteSubmit.php on line 136on line 136Maybe this code for phpvms_5.5.x <tr> <td width="1%" nowrap><strong>Captcha</strong></td> <td> <?php if(isset($captcha_error)){echo '<p class="error">'.$captcha_error.'</p>';} ?> <div class="g-recaptcha" data-sitekey="<?php echo $sitekey;?>"></div> <script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=<?php echo $lang;?>"> </script> </td> </tr> Quote
Heritage1 Posted December 17, 2015 Report Posted December 17, 2015 Very very kind, thank you for all your hard work so much Jim Quote
RyanJSmyth Posted August 25, 2016 Report Posted August 25, 2016 hey there guys im trying to run this with my airline www.apolloairways.co.uk but i think i implemented it wrongly im using the php version of phpvms please help Quote
Txmmy83 Posted July 19, 2017 Report Posted July 19, 2017 (edited) No error warning but for some reason I can not fill in anything it appear like a static screenshot any idea? PS: found the error! seems that I have not enough sleep otherwise I would recognized the missing closing div earlier anyway is there a way to limit to only the enabled fleet aircraft? I have also added a new dropdown option that Pilot can select AIRAC Cycle used for flightplan Edited July 19, 2017 by Txmmy83 Quote
OWA001 Posted September 2, 2017 Report Posted September 2, 2017 (edited) Update; Hello everyone, I have placed the module but it throws me "error!" to give him to send and nothing else happens, someone with the same problem? the module is in my site, in the menu operations / request route https://oneworldv.com/index.php/RouteSubmit Edited September 30, 2017 by OWA001 Update Information Quote
William Posted June 9, 2020 Report Posted June 9, 2020 Hey, Great work Vangelis. If I wanted to add PHP to have a drop down menu for DEP and ARR retrieving the ICAO present in the DB how would I write that? I tried to add the code myself but did not succeed. I also saw a JSON line commented out in the module, is that related to it? Appreciate the help guys! Quote
Members Vangelis Posted June 9, 2020 Members Report Posted June 9, 2020 replace <input type="text" name="arr"> <input type="text" name="depp"> with <select name="arr"> <?php foreach($allairports as $airport) { echo '<option value="'.$airport->icao.'" '.$sel.'>'.$airport->name.' ('.$airport->icao.')</option>'; } ?> </select> <select name="depp"> <?php foreach($allairports as $airport) { echo '<option value="'.$airport->icao.'" '.$sel.'>'.$airport->name.' ('.$airport->icao.')</option>'; } ?> </select> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.