Jump to content

Recommended Posts

1st time posting here.  Up front, I am in no way greatly experienced in php, html or mysql although I'm getting better.  Now for the question.  I have a php page that works perfectly ie, auto population of 6 other text/selection boxes based on a selection from one other selection box, pulling that data from a mysql db.  There is also a small javascript that will show a popup date picker calendar. 

 

I want to take this page and have it emailed rather than submit to the db once filled in.  It works flawless to the db.

 

I have tried html, but that breaks the functionality of the auto population and the java.  Can someone please point me in the right direction to a solution?  Looked at and tried almost every html or php mail programs.  I don't want anyone to fix it, I would like to exhaust everything I can before that.

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/47483-is-this-possible/
Share on other sites

Yes I want to email the information instead of it being submitted to the db, and to not use html at all if that is possible.  It seems the using html causes the auto populate and the java calendar to no longer function.  So I am hoping for an alternative to using html.  This is the line that does it. 

<form method="post" action="/cgi-bin/nmsmailer.pl"> And I think that this actually does not play well with php, which the entire page is.  Do I want to redo the page in html, no.  So what I guess what I am really after is something to replace the <form> </form> statements of html.  Probably possible in php, but I haven't found anything on that yet in extensive web searches.

Thanks again.

Link to comment
https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-231826
Share on other sites

Emailing the information gathered on the page is not a problem, that works.  What does not work when the html code is placed into the php page is the auto population of 6 text/select boxes and a java script for a calendar popup.  Without any of the email html, the page works fine and updates a db table.  My goal is to email the info 1st, update later.

Link to comment
https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232159
Share on other sites

OK Exactly.

1.  Use already developed & working php page that has many populate functions and send that info via email.

2.  Use no html to do that, as that disables populate and java functions of this particular page.

3.  I have looked at most php mailers out there, but they contain html.

 

Here is the code that gets broken by the html.

 

<?

include ("header.php");

 

$flights = get_flighttypes();

if (!$flights) {

echo "<div id=\"formstyle\">";

echo "<h2>Not enough data</h2>";

echo "</div>";

include ("footer.php");

exit;

 

}

 

$flights_select = "";

foreach ($flights as $each) {

$flights_select .= "<option value =\"$each\">$each</option>\n";

 

}

 

echo "<SCRIPT language=\"Javascript\" src=\"CalendarPopup.js\"></SCRIPT>\n";

echo "<SCRIPT language=\"Javascript\">\n";

 

$route = new Route();

$routes = $route->getAll('false');

foreach ($routes as $id) {

 

$index = "";

$routename = "";

$dep_place = "";

$dep_code = "";

$arr_place = "";

$arr_code= "";

$aircraft = "";

$flight_type = "";

$hub = "";

 

while (list($key, $val) = each ($id)) {

if ($key == "id") {

$index = $val;

$routelist[] = $index;

}

if ($key == "routename") {

$routename = $val;

$routenames[$index] = $routename;

}

if ($key == "depart_place") {

$dep_place = $val;

}

if ($key == "depart_code") {

$dep_code = $val;

}

if ($key == "arrive_place") {

$arr_place = $val;

}

if ($key == "arrive_code") {

$arr_code = $val;

}

if ($key == "aircraft") {

$aircraft = $val;

}

if ($key == "flight_type") {

$flight_type = $val;

}

if ($key == "hub") {

$hub = $val;

}

}

echo "var id$index  = \"$index\";\n";

echo "var routename$index  = \"$routename\";\n";

echo "var depart_place$index  = \"$dep_place\";\n";

echo "var depart_code$index  = \"$dep_code\";\n";

echo "var arrive_place$index  = \"$arr_place\";\n";

echo "var arrive_code$index  = \"$arr_code\";\n";

echo "var aircraft$index  = \"$aircraft\";\n";

echo "var flight_type$index  = \"$flight_type\";\n";

echo "var hub$index  = \"$hub\";\n";

 

}

 

echo "function populate(id) {\n";

foreach ($routelist as $each) {

echo " if (id == $each) {\n";

echo "document.pirep.dep_code.value = null\n";

echo "document.pirep.dep_code.value = depart_code$each;\n";

echo "document.pirep.dep_place.value = null\n";

echo "document.pirep.dep_place.value = depart_place$each;\n";

echo "document.pirep.arr_code.value = null\n";

echo "document.pirep.arr_code.value = arrive_code$each;\n";

echo "document.pirep.arr_place.value = null\n";

echo "document.pirep.arr_place.value = arrive_place$each;\n";

echo "document.pirep.aircraft.value = null\n";

echo "document.pirep.aircraft.value = aircraft$each;\n";

echo "document.pirep.flight_type.value = null\n";

echo "document.pirep.flight_type.value = flight_type$each;\n";

echo "document.pirep.hub.value = null\n";

echo "document.pirep.hub.value = hub$each;\n";

echo "}\n";

}

 

echo "}\n";

$pilotdetails = get_pilotdetails();

foreach ($pilotdetails as $pilot) {

$index = "";

$fullname = "";

$vadminid = "";

    $email = "";

   

while (list($key, $val) = each ($pilot)) {

if ($key == "id") {

$index = $val;

$pilotlist[] = $index;

}

if ($key == "fullname") {

$fullname = $val;

}

if ($key == "vadminid") {

$vadminid = $val;

}

if ($key == "email") {

$email = $val;

}

 

}

echo "var pilot$index"."_fullname = \"$fullname\";\n";

echo "var pilot$index"."_vadminid = \"$vadminid\";\n";

echo "var pilot$index"."_email = \"$email\";\n";

}

 

echo "function populate_pilot(id) {\n";

foreach ($pilotlist as $each) {

echo "if (id == $each) {\n";

echo "document.pirep.vadminid.value = null\n";

echo "document.pirep.vadminid.value = pilot$each"."_vadminid;\n";

echo "document.pirep.email.value = null\n";

echo "document.pirep.email.value = pilot$each"."email;\n";

echo "}\n";

}

 

echo "}\n";

echo "</SCRIPT>\n";

 

$fields = array(

"missing_pilot" => "pilot",

"missing_vadminid" => "vadminid",

"missing_email" => "email",

"missing_hub" => "hub",

"missing_aircraft_type" => "aircraft",

"missing_flight_type" => "flight_type",

"missing_flightdate" => "flightdate",

"missing_departurecode" => "dep_code",

"missing_departureplace" => "dep_place",

"missing_arrivalcode" => "arr_code",

"missing_arrivalplace" => "arr_place",

"missing_approach" => "approach",

);

 

echo get_jscriptValidation($fields, "pirep");

 

?>

 

html for mailer goes here to not have header errors.  Which breaks the above.

Link to comment
https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232209
Share on other sites

1.  Use already developed & working php page that has many populate functions and send that info via email.

 

I explained how to do that above.

 

2.  Use no html to do that, as that disables populate and java functions of this particular page.

3.  I have looked at most php mailers out there, but they contain html.

 

Sorry, you've lost me again. PHP is incapable of creating forms without html. Browser parse html, not PHP, PHP outputs strings, wether those strings are html or not dpends on exactly what it is your doing.

 

I think your definition of a php mailer is little different to mine. All PHP needs to send an email is the mail function, forms posting to this function are not part of the process.

Link to comment
https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232228
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.