Jump to content


Photo

PHP processing Question


  • This topic is locked This topic is locked
1 reply to this topic

#1 dsartain

dsartain
  • Members
  • PipPipPip
  • Advanced Member
  • 68 posts

Posted 06 March 2006 - 12:33 AM

Hey, I've made a page that will process a form I posted on myspace, the page updates the DB fine, but I also want it to email me when it processes the form. How can I do this? PHP code below:

<?php
$name = addslashes($_POST['name']);
$occupation = addslashes($_POST['occupation']);
$myspace = addslashes($_POST['myspace']);
$website = addslashes($_POST['website']);

$dbconn = mysql_connect("localhost","dsartain","marines"); mysql_select_db("db_mysql",$dbconn);
$query = "INSERT INTO `model_websites` VALUES('','$name','$occupation','$myspace','$website')";

$runquery = mysql_query($query,$dbconn);
if (!$runquery) {$query_result= 'Query Failed'; } else {$query_result= 'Thank You For Your Submission!!!';}
?>

I'm not displaying it so I haven't added the stripslashes yet...

If you can help me with this please EMAIL me at dsartain18@yahoo.com for some reason I'm not getting emails when someone replies to my posts...fix that later....Thanks

Don

#2 php_b34st

php_b34st
  • Members
  • PipPipPip
  • Advanced Member
  • 168 posts

Posted 06 March 2006 - 12:43 AM

You could use something like this:

//send email
$email = "email address email is to be sent to";
$from = "who is the email from";
$mesg = "message you would like to send";
$subject = "email subject";
          
if (mail($email, $subject, $mesg, $from))
return true; 
else
{
    echo 'Could not send email.';
}





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users