Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q2 QUESTION 2 a. Based on the figures below, answer the following questions: i. Write a HTML program named Add.html that will display an output

Q2
image text in transcribed
image text in transcribed
QUESTION 2 a. Based on the figures below, answer the following questions: i. Write a HTML program named Add.html that will display an output shown as in Figure 1 and send the data to a filename Add.php and the method is POST. Figure 1: Add.html (5 marks) 1. Based on Question 1(a), write a PHP code that will validate each text field and produce an error message as shown in Figure 2 if the fields are left blank. (5 marks) Figure 2: Add.php ii. Based on Question 1(a), write a PHP code that will validate each text field and produce an error message as shown in Figure 2 if the fields are left blank. (5 marks) Figure 2: Add.php ill. Create a database connection file (config.php) which are the database name is usersite, executed from localhost, user id is root and no password needed to connect to the server. (5 marks) iv. Write a PHP file name view_user.php that will display the output shown in Figure 3 in your web browser. All data are retrieved from table student as shown in Table 1. Name Age Email Farah 23 farah amal.com Ahmad Nazr 21 nazilgmail.com Nurul 30 nuru hamail.com Figure 3: view_user.php Table 1: Table student Field TypeNull Key Extra user_id int(3) no primary auto increment name varchar(50) no age varchar(2) no email varchar(30) (5 marks) QUESTION 2 a. Based on the figures below, answer the following questions: i. Write a HTML program named Add.html that will display an output shown as in Figure 1 and send the data to a filename Add.php and the method is POST. Figure 1: Add.html (5 marks) 1. Based on Question 1(a), write a PHP code that will validate each text field and produce an error message as shown in Figure 2 if the fields are left blank. (5 marks) Figure 2: Add.php ii. Based on Question 1(a), write a PHP code that will validate each text field and produce an error message as shown in Figure 2 if the fields are left blank. (5 marks) Figure 2: Add.php ill. Create a database connection file (config.php) which are the database name is usersite, executed from localhost, user id is root and no password needed to connect to the server. (5 marks) iv. Write a PHP file name view_user.php that will display the output shown in Figure 3 in your web browser. All data are retrieved from table student as shown in Table 1. Name Age Email Farah 23 farah amal.com Ahmad Nazr 21 nazilgmail.com Nurul 30 nuru hamail.com Figure 3: view_user.php Table 1: Table student Field TypeNull Key Extra user_id int(3) no primary auto increment name varchar(50) no age varchar(2) no email varchar(30)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions