this part of code send a email to user if they forgot there password.

first question i have is how can i add string and variables. this give me error
Parse error: syntax error, unexpected ':' in C:\xampp\htdocs\login_test\forgotpassword.php on line 46

$body = "Hi " . $firtname_db . ",\n Your password is" . $password_db:

2nd question can any one make user if iam using mail() function right?

else
                {
                    //success - send email
                    //get user name from table
                    $queryget = mysql_query("SELECT firstname FROM user WHERE username = '$user'") or die("query didnt work");
                    $row = mysql_fetch_assoc($queryget);    
                    $firstname_db = $row['firstname'];

                    //old_passworrddb = get from table
                    $queryget = mysql_query("SELECT password FROM user WHERE username = '$user'") or die("query didnt work");
                    $row = mysql_fetch_assoc($queryget);    
                    $password_db = $row['passwor'];

                    $to = $email;
                    $subject = "Forgot password";
                    $body = "Hi " . $firtname_db . ",\n Your password is" . $password_db:

                    echo $firstname . "/" .$username."/".$email."/";
                    if(mail($to, $subject, $body))
                    {
                    echo "message successfully sent";
                    }
                    else
                    { echo "failed";}
                }

so i fixed all the erros but iam getting this error on mail() function.
i also added $headers = "test@hotmail.com";

Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\login_test\forgotpassword.php on line 49
failed

i dont now what is smtp or smtp_port or ini_set. iam i dont know how to check it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.