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.

Link to comment
Share on other sites

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("you@email.com","POST DATA FROM SCRIPT",$body,"FROM: you@email.com");

?>

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

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("you@email.com","POST DATA FROM SCRIPT",$body,"FROM: you@email.com");

?>

 

Thank you, I'll give this a go!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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