Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check for a condition and display a result

    Hello everyone, I am new to HTML and just wanted to help my girl friend build her website. She wants to make it such that the user needs to answer a set of questions that has a condition and depending on each reply the result provided would be a alert box stating the data. for example she wants to check the age and marital status. if the age is less than 25 and marital status is single : one option should be displayed similarly if the age is less than 25 but the marital status is divorced another alert box should poop up. Can anyone please please help me with the base code in which i can check for the condition and call a function that does this. I can amend the code according to her need but i am struggling to determine the code.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,624
    Thanks
    6
    Thanked 1,001 Times in 974 Posts
    This can’t be done with HTML alone and when you speak of an “alert box” it sounds like you are talking about using JavaScript. So, first let me tell you, while JavaScript can be used as enhancement, if you wanna do it right then you use a server side script; PHP is the most popular. There are tons of basic PHP tutorials out there, and basic PHP is all you need for what you want.

    As I said, JavaScript can be used as enhancement, e. g. to calculate the value of form fields on the fly but in any case, again, if you want to do it right you wouldn’t use JS alerts to show the results, you need to employ some kind of a modal box. But really, look into PHP first.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •