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>? 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'; } 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... 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'] 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'] 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 } 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
Archived
This topic is now archived and is closed to further replies.