Question: Write a PHP script that obtains a URL and its description from a user and stores the information into a database using MySQL. Create and
Write a PHP script that obtains a URL and its description from a user and stores the information into a database using MySQL. Create and run a SQL script with a database named URL and a table named Urltable. The first field of the table should contain an actual URL, and the second, which is named Description, should contain a description of the URL. Use www.deitel.com as the first URL, and input Cool site! as its description. The second URL should be www.php.net, and the description should be The official PHP site. After each new URL is submitted, print the contents of the database in a table. The SQL script to run is:
DROP DATABASE IF EXISTS URLs;
CREATE DATABASE URLs;
USE URLs;
CREATE TABLE urltable ( ID int NOT NULL AUTO_INCREMENT PRIMARY KEY, URL varchar(128), Description varchar(255), Category varchar(255) );
In addition to the above requirements, add these steps: 1. When displaying the records from the database, there must also be a column which contains a checkbox for each row. This checkbox will indicate that the row should be deleted when the user submits the form. 2. If no records exist in the database, your software should display a message indicating that instead of an empty table. 3. When the user clicks on a row, the browser should open the URL in a new tab (unless the user clicks on the checkbox to indicate they want to delete the row). 4. You may use JavaScript and CSS to complete this assignment. If you want, your JavaScript and CSS may be placed in external files. Everything else must be in one PHP file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
