dancojocaru2000 Posted July 25, 2015 Share Posted July 25, 2015 I want to make an email form using PHP. Everything is good, BUT Is there a way to make a drop-down list and if the visitor selects Admin, email will be sent to admin@$_SERVER[DOCUMENTROOT] and if it selects Postmaster it will be sent to postmaster@<that thing>? Quote Link to comment https://forums.phpfreaks.com/topic/297473-please-help-i-didnt-find-any-good-title-describing-it/ Share on other sites More sharing options...
scootstah Posted July 25, 2015 Share Posted July 25, 2015 Sure. if ($value == 'admin') { $email = 'admin@yourdomain'; } else if ($value == 'postmaster') { $email = 'postmaster@yourdomain'; } Quote Link to comment https://forums.phpfreaks.com/topic/297473-please-help-i-didnt-find-any-good-title-describing-it/#findComment-1517374 Share on other sites More sharing options...
dancojocaru2000 Posted July 25, 2015 Author Share Posted July 25, 2015 Sure. if ($value == 'admin') { $email = 'admin@yourdomain'; } else if ($value == 'postmaster') { $email = 'postmaster@yourdomain'; } ...And $value is... Quote Link to comment https://forums.phpfreaks.com/topic/297473-please-help-i-didnt-find-any-good-title-describing-it/#findComment-1517378 Share on other sites More sharing options...
Destramic Posted July 25, 2015 Share Posted July 25, 2015 $value would be the value of the drop down list... but $value would be something like this: $_POST['to'] Quote Link to comment https://forums.phpfreaks.com/topic/297473-please-help-i-didnt-find-any-good-title-describing-it/#findComment-1517383 Share on other sites More sharing options...
dancojocaru2000 Posted July 25, 2015 Author Share Posted July 25, 2015 $value would be the value of the drop down list... but $value would be something like this: $_POST['to'] So you say that I should make something like $value = $_POST['mail'] Quote Link to comment https://forums.phpfreaks.com/topic/297473-please-help-i-didnt-find-any-good-title-describing-it/#findComment-1517385 Share on other sites More sharing options...
Destramic Posted July 25, 2015 Share Posted July 25, 2015 something like this <form method="POST" action="page.php"> Mail: <select name="mail"> <option value="admin@yourdomain">Admin</option> <option value="postmaster@yourdomain">Post Master</option> </select> <input type="submit" name="submit" /> </form> if (isset($_POST['submit'])) { $mail = $_POST['mail']; // send mail } Quote Link to comment https://forums.phpfreaks.com/topic/297473-please-help-i-didnt-find-any-good-title-describing-it/#findComment-1517388 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.