Question
Problems with AJAX/JQuery. Creatiung a HTML form that contains three input fields and an update button. After user enters an email in the email field,
Problems with AJAX/JQuery. Creatiung a HTML form that contains three input fields and an update button. After user enters an email in the email field, the form auto populates other fields. Display a message asks if user needs to update the information. If so, use can update the information (After user hits the Update button, display a message saying your information has been updated. Keep other parts on the screen as it is) . Do all these using AJAX/JQuery.
------index.html-----------
include('db.php'); $email=$_POST['email']; $address=$_POST['address']; $phone=$_POST['phone'];
$stmt = $DBcon->prepare("INSERT INTO student(email,address,phone) VALUES(:email, :address,:phone)");
$stmt->bindparam(':email', $email); $stmt->bindparam(':address', $address); $stmt->bindparam(':phone', $sphone); if($stmt->execute()) { $res="Data Inserted Successfully:"; echo json_encode($res); } else { $error="Not Inserted,Some Probelm occur."; echo json_encode($error); } ?>
----------db.sql---------
CREATE TABLE USER_INFO
(EMAIL varchar(40) NOT NULL,
ADDRESS VARCHAR(100) NOT NULL,
PHONE VARCHAR(10) NOT NULL,
PRIMARY KEY (EMAIL) );
INSERT INTO USER_INFO(
Email,
Address,
Phone)
values('fake@ppp.com', '123 Easy St.', '555555555');
INSERT INTO USER_INFO(
Email,
Address,
Phone)
values('notreal@ppp.com', '555 Main St.', '123456789');
INSERT INTO USER_INFO(
Email,
Address,
Phone)
values('unreal@pp.com', '8008 5th Ave.', '987654321');
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started