theredking Posted September 6, 2007 Share Posted September 6, 2007 Hi, I have a simple html form that POSTs to a mysql database. Can I, and if so, how can I, have it post to the mysql database, and email the form results too. I also have some other html forms that just mail() the results. So I can do both things separately, but I'm not sure how to combine them. I'm still very new to all this... Thank you in anticipation. Link to comment https://forums.phpfreaks.com/topic/68252-solved-post-to-mysql-database-and-email-results/ Share on other sites More sharing options...
micah1701 Posted September 6, 2007 Share Posted September 6, 2007 just run them one after the other...something like: <?php // 1) your script to save everything to database... ... // 2) then your script to mail the data to someone $body = print_r($_POST,true); //you'll want to expand on this, but something like: mail("[email protected]","POST DATA FROM SCRIPT",$body,"FROM: [email protected]"); ?> Link to comment https://forums.phpfreaks.com/topic/68252-solved-post-to-mysql-database-and-email-results/#findComment-343132 Share on other sites More sharing options...
roopurt18 Posted September 6, 2007 Share Posted September 6, 2007 You realize this is a lot like asking, "How can I put on my shoes and tie them too? I can put on my shoe. I can also tie my shoe if it's already on my foot. But I just can't seem to combine them." Basically, you create a form. On the page that processes it you add code that puts it in the database. Then you add more code that emails the results. Link to comment https://forums.phpfreaks.com/topic/68252-solved-post-to-mysql-database-and-email-results/#findComment-343136 Share on other sites More sharing options...
theredking Posted September 6, 2007 Author Share Posted September 6, 2007 You realize this is a lot like asking, "How can I put on my shoes and tie them too? I can put on my shoe. I can also tie my shoe if it's already on my foot. But I just can't seem to combine them." Yeh I do realise... But being so new to this, it's a little like trying to put a shoe on and tie it whilst upside down in a dark room, being spun around, and people are poking you with sticks... I'm trying, it's just hard to get my head around combining these things. Thanks Link to comment https://forums.phpfreaks.com/topic/68252-solved-post-to-mysql-database-and-email-results/#findComment-343144 Share on other sites More sharing options...
theredking Posted September 6, 2007 Author Share Posted September 6, 2007 just run them one after the other...something like: <?php // 1) your script to save everything to database... ... // 2) then your script to mail the data to someone $body = print_r($_POST,true); //you'll want to expand on this, but something like: mail("[email protected]","POST DATA FROM SCRIPT",$body,"FROM: [email protected]"); ?> Thank you, I'll give this a go! Link to comment https://forums.phpfreaks.com/topic/68252-solved-post-to-mysql-database-and-email-results/#findComment-343145 Share on other sites More sharing options...
theredking Posted September 6, 2007 Author Share Posted September 6, 2007 Thank you micah1701, that works perfectly!! Link to comment https://forums.phpfreaks.com/topic/68252-solved-post-to-mysql-database-and-email-results/#findComment-343161 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.