Jump to content

[SOLVED] POST to mysql database and email results?


theredking

Recommended Posts

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.

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]");

?>

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.

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

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.