Fantastic as usual. Followed you for years down here in NZ. Your videos are like unwrapping a present at Christmas, can't wait to see what goodies are inside.
Thanks for this tutorial. This looks like it will be more convenient than sending the viewer to a separate page. I will be doing this for my future websites.
Well done. Very simple and explained perfectly. It's important to note for people having problems it's paramount that the .php file be referenced exactly the same in your javascript because once the user submits the form the target is that file, the rest is effortless.
Thank you, really nice. As for Wordpress users or others that experience the "Please wait..."-issue - it is because your parser.php cannot be found. If you are using wordpress you'll need to include it in for example your functions.php. I found this out using the inspector, use to see where the errors occur and why.
Hi Adam, I was browsing your site and noticed there wasn't any content about web security. I would like to express my interest in this field and request some practical tutorials about it. For example, XSS, XSRF, and anything using Ajax that might compromise a database. Thanks.
Thanks for the example and mostly for the code, I was really spinning around with the serialize of php which didn't worked for me in hours. Just downloaded and customized your code and its all working fine. Thanks!
Research the terms Cross-site Scripting (XSS) and Cross-Site Request Forgeries (CSRF) attacks in a search engine to find numerous methods to defend your forms against spam and automated attacks from malicious third party servers.
Thank you for this simple tutorial. I've been trying to do this for almost a year and I was finally able to do it because of you. I'm a fan now. Question, is this form safe from hackers? I've seen other tutorials in which they add a "human" component in which they have to answer a simple question in order for the form to be accepted. If not, is this hard to do?
Great tutorial, however, I am having a bit of an issue. When I upload and run the contact script, the form stays on the page, the page will refresh and send me back to the top and it appends all the data I entered to the end of the domain name in the address bar above. Any thoughts sir? Just to update, im getting this Error now: [19-Nov-2016 15:55:39] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/php/54/usr/lib64/php/modules/imagick.so' - /usr/php/54/usr/lib64/php/modules/imagick.so: undefined symbol: zend_new_interned_string in Unknown on line 0
Hey Adam, This form works perfectly, except for the receiving part. Whenever I sumbit, the email is sended to my spam folder, how can i let it go into the regular inbox folder? Kind regards
Maybe because your email checking application's spam filtering settings are high and you only allow trusted white-listed entities land in the inbox. You could try changing the $from variable to use an email address tied to your hosting account that is sending the email, instead of the user's $e variable. I am not sure really.
Hi Mr Adam Khoury.. and how you doin mahn??!? I had to pause the video!! fucking love your work!! love how real you are about coding and programming, ive been watching your vids and you make me feel like ive been programming for years already.. you know when to elaborate what is a built in function of php and what is not built in, love that, doesnt leave me guessing what needs to be instantiated or not.. Keep up the awesome work! and May The Almighty bless you and those you love and care for in this world and the world after.aameen.
im so dissapointed i did everything u said and it does not work??? uploaded it to the server it says thanx for sending an email but it doesnt send an email?
Thanks for the reply. I was watching your videos relating OOP lately. I was wondering if you could please make a series of basic OOP related videos. Or if I have missed them, would you please tell me where to find them? Once again, thank you very much for the tutorials. They're very helpful.
thank you, it was very helpful, already up and running, i only added a subject placeholder. Only problem i have to sort is the language, in portuguese we have "ç" and "ã" and come all wrong. Great job, keep it coming and thank you for sharing
My php script is a little bit more complicated than yours Adam, but I always couldn't do the response message when people have sent the message and also, the HTML email. Thanks
Do you know how to configure XAMPP so that I don't get this error? ... Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\1ContactFormWebApplicationAjaxHtml5Php\example_parser.php on line 13 The server failed to send the message. Please try again later.
Hi Adam, Thanks for your excellent tutorial, which I used to create a nice contact form. I have a question: Would it be possible to use PHP's output buffer with a callback function to collect form data instead of using AJAX? Thanks in advance for any thoughts... -- Peter
I quadrupled check my code and its identical to yours except for the form fields and it is not working. For some weird reason it is acting as it's method is "GET" (showing the information on the browsers address bar). I made sure it was "POST" but nothing. Do you have any idea what could be wrong?
Thanks Adam, much appreciated! If anyone else interested in adding a honeypot to this, here below are some slight additions/amendments made. This worked for me in terms of the form not sending. I have been scratching my head to add a 'false' success message, but failed so far...! In form, add this line: If you're human, leave this empty: In script, add this: formdata.append( "hon-url", _("hon-url").value ); In css, hide the line in the form: .antispam {display: none;} In php, add this: if( isset($_POST['n']) && isset($_POST['e']) && isset($_POST['m']) && isset($_POST['hon-url']) && $_POST['hon-url'] == ' ' ) {....here goes the rest.....}
Browser discrepancies Okay, I get the success message in safari "thanks (name) your message has been sent", but in chrome or firefox, I just stays on "please wait". I do get the email on all browsers though. How do I fix this?
Hello Sir I am beginner of website design and developing process through youtube specially ur all content even HTML video control. I was completed all design with HTML&CSS&JS, as well as login and sing up page with PHP& Mysql database as u providing to video. But could find out how to connect both PHP script and index.html main file together in hostgator hosting service mysql database. Thank You
Hey I'm getting an error message in the console saying submitForm is not defined even though I got the same code to work for another website I'm working on. Any ideas why it would work for one site but not the other? I also tried copying and pasting the sample code and I still get the same message.
Dear Adam, Thanks so much for your excellent tutorial. Your script works flawlessly. However I'm having trouble adding a checkbox input and having it recognized. It's always either checked or unchecked, depending only on its initial value, and does not respond to user input. Any hints? -- Peter
Hi Adam, I am implementing the ajax submission on a form (following this tutorial) which inserts data into a mysql table. The problem is that the data is inserted twice every time I press submit. Can you suggest what the problem might be?
Dear Adam, I uploaded your files almost as is, on the website. The only change I made was to my email address. After clicking on "Submit", the message thanked my name, but I did not receive the email at all. I have checked my spam mail as well. Please advise, if possible. Stephen.
This was a great tutorial. I have yet to really follow up with PHP, but this was simple enough. I'll use your site references to work on the security. Other than that, everything works great. Could this work with PHPMailer?
Doesn't work. I copied your html, JavaScript, and php code exactly form your developphp page and put the codes in their respective pages. The php page was named exactly as yours. I entered the information into he fields properly and hit submit. all that happened was that the php code was displayed directly under the form.
You should have added a else in the isset of the parser, to tell the user that ons of the fields is empty if they are using a browser that does not understand the required inputs (like iOS' safari). But nice script!
sir i know only html and css can i go for this tutorial????? plase uploaded the html5 and css3 tutorial so that its very easy to getting php and javascript
Your version of Safari might need to be updated. If that is not the issue, then Apple is very slow to catch up to every other browser vendor. I don't use Safari personally so those are my best guesses.
Great tut. Just wanted to drop this comment. The latest version of Safari does not (unfortunately) support the 'required' attribute. Since Safari has about 16% of the browser market share (according to netmarketshare.com), it's something we just have to deal with. One can either use a jquery patch (there are plenty out there) or pop out something using PHP. I prefer the latter.
sir i would like to ask you a question i am making a search engine and i want to send the data by get method so that(data submitted in the search box) it appears in the url any idea what to change in this form
it say mail sent .but i do not receive any mail from this .i just changed the email address in php file and then i upload it on my domain .what else should i do .plz help
When I try to include the security.php file, I get a HTML 500 error, and if I don't include it, submitting the form (if everything is filled in) doesn't work. Any ideas?
When i click submit button it shows me success message that the message that i have sent is sended but i don't get any message in my email. Can you help me pls???
I am having the same problem, how did you solve it? I upload my files to the server to test it out and like you said, i got the success message but I did not receive the email.
Thank you so much for this video. I visited your website where i have seen some social icons on the left side of your page . if Possible then please make a video for making that
Can you make a video on how to make a website where you can make a admin account where you can upload, title and add a description and allow people to make user accounts to comment and like ? If so that would be awesome
Need form submitted message on screen of form which is whole reason for using ajax. I have a form using jquery validate, and jquery holds submit button until validation passes. Then with submit free it posts to php and php opens new window to display sent message. I want to have this message on the same page as the form.
Me too then I checked the and found that because I changed the name example_parser.php to something but hadn't changed the reference in the script. Bang.
I get this when I fill out the form: Name: '.$n.' Email: '.$e.' '.$m.' '; $headers = "From: $from "; $headers .= "MIME-Version: 1.0 "; $headers .= "Content-type: text/html; charset=iso-8859-1 "; if( mail($to, $subject, $message, $headers) ){ echo "success"; } else { echo "The server failed to send the message. Please try again later."; } } ?> Also the form doesn't disappear and the message doesn't go to my mail. I thought I might have done something wrong in the code so I used the Lesson Code, but that doesn't fix it. What is going wrong?