• Resolved yousrakasmi

    (@yousrakasmi)


    Hi there,

    Is there a simple function that would return a form (already created) if an term selected.

    In human readable format, I was expecting to dosomething like this:

    If Education category selected, returns registration form

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Dear yousrakasmi.

    u using ajax to fix this.

    Example
    <form action=”” id=”Form1″ name=”Form1″ method=”post”>
    <select id=”category ” onChange=”javascript:change_data(this.value);” name=”category “>
    <option value=””>Please select your category </option>
    <option value=””>Education </option>
    <option value=””>game</option>
    </select>
    </form>
    <div id=”return_form”></div>
    <script type=”text/javascript”>
    function change_data(send_data)
    {
    $.ajax({
    url: “ajax_page_url”,
    type: “POST”,
    data: {category : $(“#category”).val()},
    cache: false,
    success: function (result) {
    $(“#return_form”).empty().html(result);
    }
    });
    }
    </script>
    Ajax File

    $contition = $_POST[‘category’];

    if($contition == “Education”){
    $form = “your Education Form Put Here”;
    echo $form;
    }

    if($contition == “game”){
    $form = “your game Form Put Here”;
    echo $form;
    }

    Thread Starter yousrakasmi

    (@yousrakasmi)

    Thanks, dev_danidhariya it works

    Thread Starter yousrakasmi

    (@yousrakasmi)

    Thanks, dev_danidhariya it works

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How To add simple conditional fonction’ is closed to new replies.