![]() |
Submission to SQL Database & Send Email?
How would I go about changing my submission.php coding so that when someone sends info across to the database, it also sends me an email to let me know?
This is my submission.php file contents presently: Quote:
Quote:
|
Whatever you do, don't spend five seconds trying it before asking here. That would be crazy.
|
Quote:
|
Have you have tested your email form so you know it definitely works? Some servers may block it, and some email providers may not accept such email. If it works - that is you submit a form and receive an email - there should be no issue with using the mail function when people submit data.
BTW you don't need all that header shit on an email. You need To, Subject, Message, From. For example this is probably enough to test with (obviously with real email addresses), after or before your "records added successfully" line: mail("me@myhouse","Hello","How are you","From: you@yourhouse"); Edit: since newlines may be necessary, even with one line of headers (from): mail("me@myhouse","Hello","How are you","From: you@yourhouse\r\n"); |
I would do it inside the if checking results from the query.
if(mysqli_query($link, $sql)){ echo "Records added successfully."; // ...............Do the email shit right here................ $emailsubj="subject of my email"; $emailsendaddress="[email protected]"; $emailaddy2use="address I am sending to"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $headers .="From: " . $emailsendaddress . "\r\n"; mail ( $emailaddy2use, $emailsubj, $emailmessage, $headers); } |
Never mind...
. |
Whatever you do, don't spend five seconds reading a four post thread before repeating what's in it. That would be crazy.
|
Quote:
. |
I said:
Whatever you do, don't spend five seconds reading a four post thread before repeating what's in it. That would be crazy. Do you get paid per sig view? |
Quote:
Where, in the posts before mine, do you tell him that you would move the email send into the if statement testing the query, or anything like that. Dude asked: How would I go about changing my submission.php coding so that when someone sends info across to the database, it also sends me an email to let me know? And later said: I'm asking if there is another option to just appending and showing what I already tried. I gave him another option, moving it into the if statement after the query rather than doing another if. So, where the fuck did I repeat everything that is already in the thread? The email shit, I just pasted that in there to demonstrate where I would drop it in. Now, you have a problem with me? I suggest you ignore me. Oh, yeah. Go Fuck Yourself, asshole. , |
Quote:
Sorry about that. Still, fuck you for being an asshole about it. . |
Quote:
|
Quote:
Thank you. |
Moving it to that position worked great and I even managed to add a html template page to the bottom of the code so it matches the rest of the site layout.
Thank you both for the assistance :thumbsup Next on my list if the CRUD system which is almost done I just need to add a few stylesheets :) |
Quote:
|
All times are GMT -7. The time now is 03:22 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123