zer0uk Posted April 15, 2020 Share Posted April 15, 2020 Hi the below is part my code which generates an email to the user asking them to authenticate, all works fine however I want to add the new user name to the email, one for politeness but more importantly so the user has a email with the login id. I have been trying to edit my code and insert the value of the variable $var_username within the message but totally no luck figuring it out, any help appreciated. the bit of code is below $var_username = $S_POST['username']; $message = '<p>Hello</p>' . "$var_username" . '<p>Please click the following link to activate your account : <a href="' . $var_username . $activate_link . '">' . $activate_link . '</a></p>'; Quote Link to comment Share on other sites More sharing options...
requinix Posted April 15, 2020 Share Posted April 15, 2020 Do you actually have an "S_POST" array? Quote Link to comment Share on other sites More sharing options...
TrueMember Posted April 16, 2020 Share Posted April 16, 2020 U should use $_POST, try the below code: $var_username = $_POST['username']; $message = '<p>Hello</p>' . $var_username . '<p>Please click the following link to activate your account : <a href="' . $var_username . $activate_link . '">' . $activate_link . '</a></p>'; Quote Link to comment Share on other sites More sharing options...
zer0uk Posted April 19, 2020 Author Share Posted April 19, 2020 On 4/16/2020 at 9:17 AM, TrueMember said: U should use $_POST, try the below code: $var_username = $_POST['username']; $message = '<p>Hello</p>' . $var_username . '<p>Please click the following link to activate your account : <a href="' . $var_username . $activate_link . '">' . $activate_link . '</a></p>'; You was right use $_POST .. below works fine $message = '<p>Thanks for creating an account your username is - </p>' . $_POST['username'] . '<p>Please click the following link to activate your account : <a href="' . $activate_link . '">' . $activate_link . '</a></p>'; Thank you Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted April 19, 2020 Share Posted April 19, 2020 to help prevent cross site scripting, any dynamic value that you use in a html context, your email message, needs to have htmlentities() applied to it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.