Forum Moderators: coopster

Message Too Old, No Replies

a good place to look for creating rules based data in form

         

mgworek

2:50 pm on Feb 17, 2006 (gmt 0)

10+ Year Member



Like I said yesterday, I am new and wanting to learn.

On my form that I created that the data is being sent into a database, I also want to create rules to send outgoing email 1 of 5 people depending on something that was entered in the form.

This might be too complex for a newbie like me, if you think it is, just tell me.

But I am hoping for a site or book to get to read up on it and learn how to do it.

Thank you.

Scally_Ally

3:47 pm on Feb 17, 2006 (gmt 0)

10+ Year Member



That should be no problem really,
simply set retrieve the variables that are being submit and run an if statement.
<?
if($_POST["foo"] == "value"){
//set addressee here
}
if($_POST["foo2"] == "value"){
//set addressee here
}
?>

then use PHP's mail function.. heres some links.
[uk2.php.net...]
[w3schools.com...]

mgworek

8:24 pm on Feb 17, 2006 (gmt 0)

10+ Year Member



I guess I am doing this wrong. I tried it your way and I also tried it a few different ways. It works with just telling it to send out 2 different emails, no if statements. Then it worked with only one if statement but when I put two if statements, no emails get sent out.

yes, i have all my php in one thing, that might not be standard practice but i am just testing.

<?php
$Company = $_POST[Company];
$Phone = $_POST[Phone];
$Email = $_POST[Email];

$Subject = "try this";
$To = "marty_gworek@yahoo.com";
$Msg = $Company;
$Sales = "VT Sales";
$Subject1 = "Thank you for your submission";
$Msg1 = "Please do not respond to this email. <br> Your lead has been forwarded to the correct sales person. <br> you should hear something back soon!";
$Msg2 = "Nick";
$Msg3 = "bite";
if ($_Post["Company"]== "bayfront")
{
mail( $To, $Subject, $Msg, "From: $Company <$Email>");
mail( $Email, $Subject1, $Msg1, "From: $Sales");
}
if ($_Post["Company"]== "voicetech")
{
mail( $To, $Subject, $Msg, "From: $Company <$Email>");
mail( $Email, $Subject1, $Msg1, "From: $Sales");
}
# mail( $To, $Subject, $Msg3, "From: $Company <$Email>");
# mail( $Email, $Subject1, $Msg2, "From: $Sales");

$query= "INSERT INTO partner (Company, Phone, Email) VALUES ('$Company', '$Phone', '$Email')";
echo '<p>',$query;
mysql_query($query) or die('<p>problem with query:'. mysql_error());
?>

mgworek

9:31 pm on Feb 17, 2006 (gmt 0)

10+ Year Member



got it working.