bschmitt78 Posted May 6, 2007 Share Posted May 6, 2007 I just recently got an error while trying to solve an ongoing PHP problem for website I have built. The error log reads: "Fatal error: call to uundefined function, line 42 error_get_last." As I said, this error JUST popped up - how do I fix this? Also, I have not been able to get PHP variable content sent to my email address by form users. All I get is a blank email. I know the problem lies with my $header variable, but I am not sure how to fix it. Here is my script: <html> <head> <title>maillist.php</title> </head> <body> <?php $to = "myemail@myemail.com"; $subject = "Contact Us"; $headers = "From: myemail@myemail.com"; (***since this is coming from my website, should I replace the from address with some other address?? ****) $name = $_POST['name']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $phone = $_POST['phone']; $email = $_POST['email']; $comments = $_POST['comments']; $message = "$name\n$address\n$city\n$state\n$zip\n$phone\n$email\n$comments"; $sent = mail($to, $subject, $message, $headers); //print thank-you message if ($sent == true) { //redirect to home page echo "Thank you, <b>$name</b>. We will contact you soon."; header ('Refresh: 3; URL = http://www.mysite.org'); exit(); } else { echo "Something went wrong with mail!"; print_r(error_get_last()); header ("Location: http://www.mysite.org/maillist.html"); exit(); } ?> </body> </html> I am new to prgramming with PHP so any help would be appreciated! I am anxious to get these prblems solved. Quote Link to comment https://forums.phpfreaks.com/topic/50202-solved-php-error_get_last-problem/ Share on other sites More sharing options...
genericnumber1 Posted May 6, 2007 Share Posted May 6, 2007 what version of php are you using? error_get_last is a php5.2 function, that could be the problem. Quote Link to comment https://forums.phpfreaks.com/topic/50202-solved-php-error_get_last-problem/#findComment-246450 Share on other sites More sharing options...
bschmitt78 Posted May 6, 2007 Author Share Posted May 6, 2007 Honestly, I don't know. I just tried to find out what PHP version Yahoo! (my host) supports and couldn't find the answer. Maybe someone in this forum or you might know? Also, any ideas as to what might be causing my form handling problem (the blank emails?) Quote Link to comment https://forums.phpfreaks.com/topic/50202-solved-php-error_get_last-problem/#findComment-246817 Share on other sites More sharing options...
bschmitt78 Posted May 6, 2007 Author Share Posted May 6, 2007 I JUST found the PHP version I am using: it's 4.3.11. Quote Link to comment https://forums.phpfreaks.com/topic/50202-solved-php-error_get_last-problem/#findComment-246821 Share on other sites More sharing options...
genericnumber1 Posted May 7, 2007 Share Posted May 7, 2007 if you can't set your php version to something >= 5.2 you'll have to stop using error_get_last(), it doesn't exist in your current version of php Quote Link to comment https://forums.phpfreaks.com/topic/50202-solved-php-error_get_last-problem/#findComment-246948 Share on other sites More sharing options...
bschmitt78 Posted May 7, 2007 Author Share Posted May 7, 2007 Gotcha. I took the error_get_last function out completely. Also, I changed if ($sent==true) to if (isset($_POST['submit'])) and this fixed my existing problem with echoing the $name variable to the php page, but now I am not receiving an email at all. I was getting emails before but they were blank. Do you see a problem with my PHP code? Quote Link to comment https://forums.phpfreaks.com/topic/50202-solved-php-error_get_last-problem/#findComment-246954 Share on other sites More sharing options...
bschmitt78 Posted May 9, 2007 Author Share Posted May 9, 2007 Turns out the issue was not with the script, but with my email headers through my account. I disabled HTML/graphics emails, since this form info does not contain any of the above) and I tested it and it worked!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/50202-solved-php-error_get_last-problem/#findComment-249065 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.