insert form field depending on radio or dropdown list selection
Hello Every one
I have a form for email setup for a cms i making, what im trying to accomplish is that i have a drop down list menu where the user selects either if its PHP mailer or SMTP i also have a javascript that show hides divs if php mailer is selected all other fields are hidden but if the user selects SMTP, then it shows text fields for Hostname, Login, Password, Port and so on, so if my user selects SMTP he has to fill those field if he saves or updates, they are filled in the database the next time i go in to that update file, i select PHP mail, but the SMTP fields are filled with the data from the database and even if they are in a hidden div they get inserted again so what i need is some kind of condition that if i select PHP mailer it deletes the data or makes it NULL again in the database , im trying something like this but with no luck yet:
<?php echo ((isset($_POST["etype"]) && $_POST["type"] = "PHP")?($_POST["hostname"]):"NULL"); ?>
I think im missing on a way that if its the other type it should insert values on what is in the form field any help?