Question
I am working on a new Project were I have to display data from DB in these 2 different pages. This is the first page(customerLookup)
I am working on a new Project were I have to display data from DB in these 2 different pages.
This is the first page(customerLookup) were I need to get the information from the DB and display it. In the second page(customerMaster) I will have to display the information from the first page.
I need to do a few things.
1- Make the search box work with AJAX.
2-Make each row a primary id so when you click will send you to the second page with the rigth information getting it from the primary id.
Try to:
1-Make each row a form and add a view button to the last cell of each row.
2-Make form action the appropriate master page.
3-Add a hidden input value to each row form and place the primary id of the row as the value.
This is the second page.
Now, on the master pages, load the hidden input value with GET or POST into a variable and use it to run a query to load the correct info.
This is the DB scripts. Let me know if I have to do any modification to the DB:
CREATE TABLE Jobs ( JobID INT NOT NULL AUTO_INCREMENT, JobTitle VARCHAR(45) NULL, CustomerID INT NOT NULL, Department VARCHAR(45) NULL, ContactID1 INT NULL, ContactID2 INT NULL, StartDate DATE NULL, EndDate DATE NULL, Shift VARCHAR(5) NULL, StartTime VARCHAR(45) NULL, EndTime VARCHAR(45) NULL, Pay VARCHAR(45) NULL, Requirements VARCHAR(200) NULL, Description VARCHAR(200) NULL, Active BOOLEAN NULL, Filled BOOLEAN NULL, PRIMARY KEY (JobID), FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID) );
CREATE TABLE CustomerContacts ( ContactID INT NOT NULL AUTO_INCREMENT, CustomerID INT NOT NULL, FirstName VARCHAR(45) NULL, LastName VARCHAR(45) NULL, Title VARCHAR(45) NULL, Phone VARCHAR(45) NULL, Email VARCHAR(45) NULL, PRIMARY KEY (ContactID), FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID) );
This is the code for each page:
customerLookup:
Software X
Customer Lookup
- Menu
- Dashboard
- Employees
- Customers
- Schedule
- Settings
- Logout
Name | Division | Address | City | State | Phone | |
---|---|---|---|---|---|---|
".$row["Name"]." | ".$row["Division"]." | ".$row["Address"]." | ".$row["City"]." | ".$row["State"]." | ".$row["Phone"]." | ".$row["Email"]." |
customerMaster:
Software X
Customer Master
- Menu
- Dashboard
- Employees
- Customers
- Schedule
- Settings
- Logout
$sql="SELECT * FROM Customers";
$results= mysqli_query($db, $sql); if($row = mysqli_fetch_array($results)){
?>
Contacts
First Name | Last Name | Job Title | Phone | Department | |
---|---|---|---|---|---|
".$row["FirstName"]." | ".$row["LastName"]." | ".$row["Title"]." | ".$row["Phone"]." | ".$row["Department"]." | ".$row["Email"]." |
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