close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

insert form field depending on radio or dropdown list selection

Thread began 1/11/2014 4:21 pm by Miguel | Last modified 1/12/2014 11:12 pm by Jason Byrnes | 329 views | 3 replies |

Miguel

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:
<?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?

Sign in to reply to this post

Jason ByrnesWebAssist

at line 1 of the page add an if statement that will set the fields to empty if PHP is selcted

from your previous example, it;s hard to tell if the field is named type or etype, but an example would be:

<?php
if(isset($_POST["type"]) && $_POST["type"] == "PHP") {
$_POST["hostname"] = "";
$_POST["Login"] = "";
$_POST["Password"] = "";
$_POST["Port"] = "";
}
?>
Sign in to reply to this post

Miguel

Thank you Jason worked like a charm

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...