Jump to content

stjonesMSI

Members
  • Posts

    22
  • Joined

  • Last visited

stjonesMSI's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks! That worked! I was close, I had just screwed up the single quotes! Time to take a break from staring at the screen!
  2. Here is the code at the end of my PHP file I am working on (as a novice user): $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: " . $from . "\r\n" ."Reply-To: " . $to . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $retval = mail($to, $subject, $message, $headers); echo "<br>"; if( $retval == true ) { echo "<h1>Thank you!</h1>\r\n<br>"; echo "Your application for employment has been successfully transmitted to <strong>Morgan Smith Industries</strong>.<br>"; } else { echo "Message could not be sent to >".$to."<"; } echo "<br<br><br>"; echo date("D M d, Y G:i a"); echo "<br><br>"; ?> </body> </html> I want to be able to place an image on the web page that opens after the form is submitted, above the "Thank you" line. I can't seem to figure out the syntax needed in PHP to put the image "URL" into the PHP language, Any pointers? Thanks! Steve
  3. I am a novice at PHP, as I have stated in pretty much all of my posts. I am learning my way through it on this current project. I realize my coding is not as efficient as it would be had I been doing it for years or were it my major field of study or employment. I am taking one piece / step at a time and trying to not only "do it" but also understand each baby step so I can actually LEARN the language. I know what an array is - but I am not trying to do anything with arrays now. I am trying to learn what I need at the moment. I will get to arrays. And then once I learn about them and PHP I will revisit my code an update it. But as of right now, the text you quote and chastise me for not pursuing is 80% gobbley-gook to me. I find it extremely frustrating that when a question gets asked (and not just in this PHP Forum but other forums for other products I use) that someone always answers a question by not actually answering the question but instead either a) heaping on other ways of doing things that they think are better/more advanced/more appropriate while providing no real assistance to the person asking the question. or b) chastise the person asking the question for not using a previous response that was not helpful to the poster. I am 52 years old. I taught as a tenured college professor for 15 years. I am not stupid. Early in my teaching career I realized that you respond to each student's question AT THEIR LEVEL. I am not trying to be ungrateful - I am just frustrated with responses to questions that are posted that are not really answered. Above, "Ch0cu3r" gave a very helpful and exact answer to what I asked at a level that was simple and direct for a novice and didn't tell me to jump to a more advanced level of knowledge to fix the problem at hand that simply would have made the task even harder to complete.
  4. Here is the code with the final variable names with lots of lines between deleted. The problematic 3 lines are commented out in this piece and marked in red. Also, in all the places it reads "EMAIL ADDRESS REMOVED" in the code on our server there is a real email address there. <html> <head> <title>Sending HTML email using PHP</title> </head> <body> <?php error_reporting(E_ALL); ini_set('display_errors', '1'); if($_SERVER['REQUEST_METHOD'] == "POST") $to = "EMAIL ADDRESS REMOVED" ; //$to = "EMAIL ADDRESS REMOVED" ; $from = "EMAIL ADDRESS REMOVED"; //$cc = "EMAIL ADDRESS REMOVED"; $subject = "ONLINE MSI JOB APPLICATION FORM"; //$message = "Testing 123.\r\n\r\nwww.morgansmithllc.com\phpdave.php"; $APPLICANT_NAME = $_POST['applicant_name']; $APPLICANT_NAME = strip_tags($APPLICANT_NAME); $APPLICANT_ADDRESS = $_POST['applicant_address']; $APPLICANT_ADDRESS = strip_tags($APPLICANT_ADDRESS); $APPLICANT_CITY = $_POST['applicant_city']; $APPLICANT_CITY = strip_tags($APPLICANT_CITY); $APPLICANT_STATE = $_POST['applicant_state']; $APPLICANT_STATE = strip_tags($APPLICANT_STATE); $APPLICANT_ZIP = $_POST['applicant_zipcode']; $APPLICANT_ZIP = strip_tags($APPLICANT_ZIP); $APPLICANT_HOME_PHONE = $_POST['applicant_home_phone']; $APPLICANT_HOME_PHONE = strip_tags($APPLICANT_HOME_PHONE); $APPLICANT_MOBILE_PHONE = $_POST['applicant_mobile_phone']; $APPLICANT_MOBILE_PHONE = strip_tags($APPLICANT_MOBILE_PHONE); $APPLICANT_EMAIL = $_POST['applicant_email']; $APPLICANT_EMAIL = strip_tags($APPLICANT_EMAIL); $APPLICANT_SOCIAL_SECURITY = $_POST['applicant_social_security']; $APPLICANT_SOCIAL_SECURITY = strip_tags($APPLICANT_SOCIAL_SECURITY); //if (empty(trim($APPLICANT_SOCIAL_SECURITY))) { // $APPLICANT_SOCIAL_SECURITY = "No answer entered"; //} $APPLICANT_DRIVERS_LICENSE = $_POST['applicant_drivers_license']; $APPLICANT_DRIVERS_LICENSE = strip_tags($APPLICANT_DRIVERS_LICENSE); -- LOTS OF DATA PULLED FROM FORMS AND PUT INTO VARIABLES AND EMAIL FORMATTED WITH TEXT AND THE VARIABLES DELETED -- "; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; //$headers .= "Content-type:text/plain;charset=iso-8859-1" . "\r\n"; $headers .= "From: " . $from . "\r\n" ."Reply-To: " . $to . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $retval = mail($to, $subject, $message, $headers); //$retval = mail($cc, $subject, $message, $headers); echo "<br>"; if( $retval == true ) { //echo "Message sent successfully to >".$to."<"; echo "<h1>Thank you!</h1>\r\n<br>"; echo "Your application for employment has been successfully transmitted to <strong>Morgan Smith Industries</strong>.<br>"; } else { echo "Message could not be sent to >".$to."<"; } echo "<br<br><br>"; echo date("D M d, Y G:i a"); echo "<br><br>"; // phpinfo(); ?> </body> </html>
  5. Yep - has that exact code in it and it has caught lots of errors over the past couple of weeks as I'm learning this. But in this case no errors appear on the web page that opens. It's totally blank. Steve
  6. The PHP file is over 700 lines of code, so it's a bit much to post. If I leave those three lines in and put some text into the form field and then hit SUBMIT, I get the field contents emailed to me just fine. If I comment out those 3 lines out and put some text into the form field and then hit SUBMIT, I get the field contents emailed to me just fine again. If I comment out those 3 lines out and leave blank the form field and then hit SUBMIT, I get the field contents emailed to me just fine again - it's just blank (like it should be). BUT - if I leave those three lines IN and leave the form field BLANK, upon SUBMIT my web form goes to a blank web page (rather than the "thanks for submitting" page it does for all the other scenarios) and I don't get an email. Could it be something abut empty vs. is_null vs. isset? it seems all these test for a variable's content? Is one preferred over the other? Thanks! Steve
  7. Hello. Novice PHP coder here. I am working on a web form. I would like to check on one field (that I put into a variable) if that form field is empty when the user pressed SUBMIT, and if so, to put a text string into the variable for that field content. In looking at the PHP manual and examples online, I have if (empty(trim($VARIABLE_NAME_HERE))) { $VARIABLE_NAME_HERE = "Put text here"; } When I test it with contents in the field, I get the contents in the email But when I test with leaving the form blank, I get a blank in the email and not the text "Put text here". What am I missing? I tried using is_null as well and have the same problem. Thanks! Steve
  8. Thanks for the condescending and not at all helpful response. I asked some very specific questions in my post regarding this change to the ACTION section. I am quite aware of what the ACTION section does and was pointing out what SEVERAL sources online about verification state the action tag should be and then I asked several specific questions about how that "new" tag worked. If my questions are too "dumb" for you, then please just don't bother to respond rather than feeling the need to give an insulting response.
  9. OK. It sounds like I need to talk to our IT guy again. The web pages are all HTML - not PHP. If the IT person sets it up so HTML parses as PHP, what will that do to all my HTML pages that have no PHP in them? Will they still render in a browser OK? Or am I going to have to re-code a bunch of stuff? I switched because, as others pointed out, there is no validation in my PHP and in looking for examples and tutorials online, this is how 2-3 sites recommended doing it. Is there a way to validate from the external PHP file the FORM calls? Or from within the HTML page itself without PHP?
  10. Thanks - I have just started working on the validation. From examples online I have found that my FORM line should contain: form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>"> it was: <form action="send_job_app.php" method="post"> which worked to get the form data to me just fine. I have looked at the PHP manual entries on $_SERVER and "PHP_SELF" but am still not clear on them. Are these items pulled from the server when the form is submitted? When I put this code at the start of my FORM, the characters "> appear at the very top of the web page and are visible as if they weren't code. When I click SUBMIT, I get an page not found error and the URL in the browser reads: http://www.morgansmithllc.com/%3C?php%20echo%20htmlspecialchars%28$_SERVER[ In the PHP Manual its says "PHP_SELF" is the name of the running script relative to the root. Do I need to code that in somehow or is PHP pulling that from the server? As I had it originally, the action was "send_job_app.php". How does this newer code know what to send? I have a feeling I am missing something, somewhere. FYI - the example in verification I am looking at is at: http://www.sitepoint.com/form-validation-with-php/ Thanks! Steve
  11. Thanks to this group, I am getting my first PHP script set up and running. It is an online job application form for my employer that just emails the fields of the form to an email account - pretty basic for now. In the past 24 hours I have received TWO of the submitted forms to my inbox. They are mostly blank - as if someone went to the page and clicked SUBMIT without filling anything out (I have not yet added any code to stop blank forms). I thought maybe someone had stumbled on the simple unpublished form or that one of the two other folks here that know where the form is located had been testing it. They said they had not and I changed the URL of the form to one much more obscure. That was at about 8AM this morning. Just now I received a THIRD blank email from the form, even after changing the URL. How can the PHP script be getting triggered on its own? Our IT person said maybe a bot is triggering it. Is that possible? If so, how can I trap for that so I don't get random blank emails? Thanks in advance for any help you can give! Steve
  12. OK - the problem was our IT guy had NOT set up PHP on the server to handle emails - even though he said he had. So now things are working and I am chugging along with getting this project to work. Thanks!
  13. The email is simply to have the form data from a web page emailed to a single, internal email address here once the user clicks the SUBMIT button on the form. Both the source and destination of that email are on the same domain. That's it. Our IT person has that set up on our parent company website - but not on ours. I realize I am a newbie to PHP and struggling with basics of PHP. But I'm not trying to do anything complex - this should be a fairly simple "starter" project. Just submit a form to an email address.
  14. OK - in a holding pattern now. I had been trying to reach our IT person about this all week. Just now got this response: So it seems that even though I had confirmed with him in advance that PHP was on ther server and told him what I was needing to do, the server is not set up to send an email using PHP? *sigh* And what the heck is "Phone"? I don't see "Phone" in the PHP manual. So I guess I get to wait til Monday to see if he "turns mail on". *sigh again*
×
×
  • 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.