JQuery - If statement for Eform

i am trying to populate a text box based on the outcome of a dropdown.

i am trying to populate a text box based on the outcome of a dropdown.

currently if i use:

$(document).ready(function () {
  //if Department is changed
  $("#Field9").on('change',function(){
    $("#Field27").val(3);
});

i get "3" in the correct field so that's fine i know the field references are correct.

my scenario is i want to customise "Field27" based on the options in the dropdown ("Field9".

my existing code is:

$(document).ready(function () {
  //if Department is changed
  $("#Field9").on('change',function(){

//check is equal to planning
if($("#Field9").val() == "Planning"){
$("#Field27").val(3);
}
else{
$("#Field27").val(4);
}

}

});
});

can anyone advise why the if statement is not working as desired? it's not even populating 4 in the "else" statement


Multiple form submit upon last form PHP

I am working on a web application using PHP and sql on localhost using wamp server.

I am working on a web application using PHP and sql on localhost using wamp server.

I have a requirement to make multiple forms Like personal details, Physical detail medical detail and religion detail with save button for each form in each page of a form. For these forms I designed database tables separately, like personal detail , medical, religion and users details have separate database tables with primary key and a foreign key of User Id from user table to distinguish records specific to each user.

  1. My problem now is what approach will I use to submit all forms with single button? Before submitting my application checks whether all required fields are filled or not if filledthen it would submit all pre filled forms.
  2. Second question is when user submits all forms with single click
  3. where is data is to be stored ?


User login form using jquery ajax not working properly, not directing to any page

I'm trying to create a login form with jquery ajax by taking user details from "reg" table in database. But It'snot working .I want to enter anothe page called menu.php after login. Nothing is showing when i click login button Can anyone help please

I'm trying to create a login form with jquery ajax by taking user details from "reg" table in database. But It'snot working .I want to enter anothe page called menu.php after login. Nothing is showing when i click login button Can anyone help please

<script type="text/javascript">
         $(document).ready(function(){

$('#loginForm').submit(function(event) {
event.preventDefault();
$.ajax({
url: "logindata.php",
type: "POST",
data: {
username: $("#username").val(),
password: $("#password").val()
},
success: function(response)
{
if(response == 1)
{
window.location.href = "menu.php";
}
else
{
$("#errorMessage").html("Attempting Login...");
}
}
});

       });
});
        &lt;/script&gt;

Here is the HTML:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<center><b>Login</b></center><br>
<form name="loginForm" id="loginForm" action="" method="post" align="center">
Username: <input type="text" name="username" id="username" /><br><br>
Password: <input type="password" name="password" id="password" /><br><br><br>
<input type="submit" name="login" id="login" value="Sign In" />
</form>

Mysql query page:

<?php
$conn =mysqli_connect("localhost", "root", "", "project");

$f="SELECT * FROM reg WHERE uname='" . $_POST["username"] . "' and password = '". $_POST["password"]."'";
$result = mysqli_query($conn,$f);
$row = mysqli_fetch_assoc($result);
if( $row[0] > 0 )
{
echo 'true';
}
else
{
echo 'false';
}
?>

?>


jQuery Full Course - jQuery Tutorial From Beginner to Advanced - Learn jQuery 2019

jQuery is a cross-platform JavaScript library designed to simplify the client-side scripting of HTML. In this video, you'll learn jQuery from Beginner to Advanced

jQuery is open-source software using the permissive MIT License. Web analysis indicates that it is the most widely deployed JavaScript library by a large margin.

Mastering jQuery will boost up your career specially in web development. This course is designed you to master yourself in jQuery through step by step process.

Course Contents

  • jQuery Intro
  • What is jQuery and what you will learn?
  • Downloading jQuery
  • jQuery Basics
  • A first look at jQuery code
  • Selectors and Filters
  • Replacing contents
  • Handling events
  • Hide/Show events
  • Fading
  • Slide
  • Toggle
  • Animate
  • Selectors
  • Filters
  • jQuery Advanced
  • Advanced Selectors
  • Creating Content
  • Creating Content: Part 2
  • Inserting content
  • Modifying content
  • Modifying CSS
  • Final thoughts


What you’ll learn

  • Will become Master in client side web development
  • Will become expert in jQuery
  • Will earn working experience on jQuery
  • Are there any course requirements or prerequisites?
  • Prior experience on HTML and CSS required.
  • Who this course is for:
  • Who wanna expert in client side web development
  • Who wanna expert in jQuery


Thanks for watching

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter