RocketRod Posted April 18, 2007 Share Posted April 18, 2007 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! Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/ Share on other sites More sharing options...
MadTechie Posted April 18, 2007 Share Posted April 18, 2007 what the goal ? you want to email a html page ? if so checkout phpmailer Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-231732 Share on other sites More sharing options...
RocketRod Posted April 18, 2007 Author Share Posted April 18, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-231826 Share on other sites More sharing options...
RocketRod Posted April 18, 2007 Author Share Posted April 18, 2007 I should also mention that when I use the html mailer code, I get the contents emailed just fine, but the php functionality of auto populate and java do not work then. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-231831 Share on other sites More sharing options...
RocketRod Posted April 18, 2007 Author Share Posted April 18, 2007 Bump back to 1st page. Still need some direction please. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232121 Share on other sites More sharing options...
trq Posted April 18, 2007 Share Posted April 18, 2007 Your question is a little vague. You want to email the contents of a form? Simple, post the form to a mail.php file, within mail.php, use the mail fuction to send the posted data to an email address. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232128 Share on other sites More sharing options...
RocketRod Posted April 18, 2007 Author Share Posted April 18, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232159 Share on other sites More sharing options...
boo_lolly Posted April 18, 2007 Share Posted April 18, 2007 care to post some code? Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232165 Share on other sites More sharing options...
rcorlew Posted April 18, 2007 Share Posted April 18, 2007 You could simply mail a link that would run a sql query to the item id of what was just put into the db. Then would would not have to use html at all until the link is clicked if that is possible. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232167 Share on other sites More sharing options...
trq Posted April 18, 2007 Share Posted April 18, 2007 Sorry, Im still a little lost about exaclty what you want to do. Are you trying to email a html page with this form and calander? Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232181 Share on other sites More sharing options...
RocketRod Posted April 18, 2007 Author Share Posted April 18, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232209 Share on other sites More sharing options...
MadTechie Posted April 18, 2007 Share Posted April 18, 2007 Am i the only one still lost here!! PS you should also use the code tags new question why don't use use mail(); Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232224 Share on other sites More sharing options...
trq Posted April 18, 2007 Share Posted April 18, 2007 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. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232228 Share on other sites More sharing options...
RocketRod Posted April 18, 2007 Author Share Posted April 18, 2007 Simple, post the form to a mail.php file, within mail.php, use the mail fuction to send the posted data to an email address. Sorry, I overlooked what you said here. I am not sure how to do that, point me in the direction please. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232237 Share on other sites More sharing options...
boo_lolly Posted April 18, 2007 Share Posted April 18, 2007 www.php.net/mail Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232241 Share on other sites More sharing options...
RocketRod Posted April 18, 2007 Author Share Posted April 18, 2007 OK, but how does this change? <td><input type="submit" value="Log Entry"></td input type ="submit" adds the data to a mysql table, which I want to email instead. I think I can get the mail from: to: subject: done, but I'm confused on how to post it. Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232285 Share on other sites More sharing options...
boo_lolly Posted April 18, 2007 Share Posted April 18, 2007 at the top of the page that your form is posting to, put something like: if(isset($_POST)){ /*perform mail function instead of mysql query*/ } Quote Link to comment https://forums.phpfreaks.com/topic/47483-is-this-possible/#findComment-232330 Share on other sites More sharing options...
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.