Hello!
I just start using PHP and I think that I my question is so easy for you.
What I like to do, relations can submit their e-mail address at our website to receive their details from our mysql.
If the e-mail address is in the database we will send the details to that address.
Their can be multiply records with this address so I like put the results in a table.
What I build gives only one record without a table? Who is so kind to help me out, greetings from Haarlem, the Netherlands
$host="
$username=
$password="
$db_name="
mysql_connect("$host", “$username”, “$password”)or die(“cannot connect to server”);
mysql_select_db("$db_name")or die(“cannot select DB”);
$email_to=$_POST[‘email_to’];
$tbl_name=reservation;
$sql=“SELECT firstname, lastname FROM $tbl_name WHERE email=’$email_to’”;
$result=mysql_query($sql);
{
$rows=mysql_fetch_array($result);
$firstname=$rows[‘firstname’];
$lastname=$rows[‘lastname’];
$to=$email_to;
$subject=“Your details”;
$header="from: your name ";
// Your message
$messages= “Your details rn”;
$messages.=“Your firstname is $firstname rn”;
$messages.=“Your lastname is $lastname rn”;
$messages.=“bla bla. rn”;
$sentmail = mail($to,$subject,$messages,$header);
}
if($sentmail){
echo “Your details are sent to your Email Address.”;
}
else {
echo “Cannot send password to your e-mail address”;
}
?>