Need some help with this piece of code
Posted: Tue Oct 01, 2002 9:53 pm
Hi, I'm new to this forum. I just started php and I've a small problem.
I just want to know if the following piece of code is the correct way to insert data into the database and at the same time, send e-mail to 2 different addresses.
Any help with this would appreciated. Thanks.
<?php
if ($submit == "click"){
$connection = mysql_connect ("", "", "");
if ($connection == false){
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
}
$query = "insert into person_db values ('$Name','$Address','$UniversityCompany','$PositionCourseofstudy','$E_mail')";
$result = mysql_db_query ("person_db", $query);
if ($result){
echo "Success!";
}
else{
echo mysql_errno().": ".mysql_error()."<BR>";
}
mysql_close ();
}
else{
echo "
$recipient = "elely@nus.edu.sg,eleadc@nus.edu.sg";
$subject = "Software download Person details";
$message = "Hello!\n\n'$Name','$Address','$UniversityCompany','$PositionCourseofstudy','$E_mail'\n\n";
mail ($recipient, $subject, $message);
?>
I just want to know if the following piece of code is the correct way to insert data into the database and at the same time, send e-mail to 2 different addresses.
Any help with this would appreciated. Thanks.
<?php
if ($submit == "click"){
$connection = mysql_connect ("", "", "");
if ($connection == false){
echo mysql_errno().": ".mysql_error()."<BR>";
exit;
}
$query = "insert into person_db values ('$Name','$Address','$UniversityCompany','$PositionCourseofstudy','$E_mail')";
$result = mysql_db_query ("person_db", $query);
if ($result){
echo "Success!";
}
else{
echo mysql_errno().": ".mysql_error()."<BR>";
}
mysql_close ();
}
else{
echo "
$recipient = "elely@nus.edu.sg,eleadc@nus.edu.sg";
$subject = "Software download Person details";
$message = "Hello!\n\n'$Name','$Address','$UniversityCompany','$PositionCourseofstudy','$E_mail'\n\n";
mail ($recipient, $subject, $message);
?>