ben_is_happy Posted May 24, 2011 Share Posted May 24, 2011 Hi all, I have a site where people can sign up for a service. I want to be able to create a form that registers a user in my database (so they can log in, pay a bill and then log out). In the form I want to be able to send myself a form saying that I have a new order with the relevent information. So to be clear, Part 1 of the form would be a user signing up (the details like email and password would be used to access their account) Part 2 would be information sent over to me via email Please someone help me! Thanks, Ben. Link to comment Share on other sites More sharing options...
abigail Posted May 24, 2011 Share Posted May 24, 2011 This is code snippet of what I use: if ( (isset($_POST['email'])) && (!empty($_POST['email'])) ) $e = $_POST['email']; mail(CT, MY_SUB, $body, "From:" . $e); You might also check that email is valid. CT is my email address. MY_SUB is the email subject line that I give it. $body is the information the user has input. You'll have to grab that from your form, similar to the way I do email address. I think you also have to have mail enabled on your server. I hope this is the information you are looking for. I don't use this particular book, so if this book doesn't have example of forms, then some of Larry's other books do. 1 Link to comment Share on other sites More sharing options...
ben_is_happy Posted May 26, 2011 Author Share Posted May 26, 2011 Hey, Thanks for this! Does anyone know if I can have to actions on one form? Thanks, Ben. Link to comment Share on other sites More sharing options...
Larry Posted May 27, 2011 Share Posted May 27, 2011 One thing to keep in mind is that information sent over email is harder to protect. It's easy to use SSL for Web activity, but to secure an email, the sender needs to use SSL, you need to use SSL to get the email, and the email really ought to be encrypted because it'll go through computers in between. That's assuming there's something sensitive in the email. As for two actions on one form, if I understand your question, you can't do that using HTML. You can use JavaScript to fake it, but it'd be better to create two different forms with two different actions. Link to comment Share on other sites More sharing options...
ben_is_happy Posted June 9, 2011 Author Share Posted June 9, 2011 One thing to keep in mind is that information sent over email is harder to protect. It's easy to use SSL for Web activity, but to secure an email, the sender needs to use SSL, you need to use SSL to get the email, and the email really ought to be encrypted because it'll go through computers in between. That's assuming there's something sensitive in the email. As for two actions on one form, if I understand your question, you can't do that using HTML. You can use JavaScript to fake it, but it'd be better to create two different forms with two different actions. Hi Larry, Once again thank you for replying to me. Thank you for the advice regarding e-mail. The site will have SSL and will look into encrypting form to e-mail. I have redesigned the form and no longer need it to have two form actions as I just have one form. I love learning php very much and learn something new each day. Keeps me busy! Thanks again, Ben. P.S. You can close this thread if you want to? Link to comment Share on other sites More sharing options...
Recommended Posts