Question

12. Suppose you are going to make an online questionnaire to collect information of current trend of the social networking Ap

0 0
Add a comment Improve this question Transcribed image text
Answer #1

<!-- form.html -->

<!DOCTYPE html>
<html>
<head>
   <title>Questionnaire Form</title>
</head>
<body>
   <form action="process.php" method="POST">
   <h3>Which of the Following social Networking App(s) are you a member of?</h3>
   <br>
   <input type="radio" name="app" value="facebook"> Facebook
   <br>
   <input type="radio" name="app" value="Instagram"> Instagram
   <br>
   <input type="radio" name="app" value="Snapchat"> Snapchat
   <br>
   <input type="radio" name="app" value="WeChat"> WeChat
   <br><br>
   <h3>What is Your Age?</h3>
   <br>
   <input type="radio" name="age" value="18-24"> 18-24
   <br>
   <input type="radio" name="age" value="25-34"> 25-34
   <br>
   <input type="radio" name="age" value="35-44"> 35-44
   <br>
   <input type="radio" name="age" value="45-54"> 45-54
   <br>
   <input type="radio" name="age" value="above"> 55 or above
   <br><br>
   Name: <input type="text" name="name">
   <br><br>
   <input type="submit" value="Submit">
   </form>


</body>
</html>

////////////////////////////////////////////////////////////

//process.php//

<?php
//getting all values from form.html by post method
$app = $_POST['app'];
$age = $_POST['age'];
$name = $_POST['name'];

//checking wether all values are inserted or not
if(!isset($app)){
   echo nl2br("\nError! App not selected.");
   //if a value is not inserted sleep for 5 seconds
   sleep(5);
   //and then go to form.html page
   header("form.html");
}
if(!isset($age)){
   echo nl2br("\n\nError! Age not selected.");
   sleep(5);
   header("form.html");
}
if(!isset($name)){
   echo nl2br("\n\nError! Name not selected.");
   sleep(5);
   header("form.html");
}

//CONNECTION TO DATABASE//
$server = "compserver";
$databse = "exam";
$user = "root";
$pass = "comp3421";

$connect = mysqli_connect($server, $user, $pass, $databse); //query to connect database

if(!$connect)
echo "Error! Connection Faild to Database.";
//END OF CONNECTION//

//INSERTING DATA TO DATABASE TABLE 'questionnaire' //
$query = "INSERT INTO questionnaire(name, age, apps) VALUES('$name', '$age', '$app')";
if(mysqli_query($connect, $query))
echo "Thank you for Completing the questionnaire!";
else {
    echo "Data Insertion to database Failed!";
}

?>

//PROGRAM OUTPUT//

C:\xampp\htdocs\www\pro Questionnaire Form х + 0 o localhost/www/form.html Which of the Following social Networking App(s) arFile Edit Search View Encoding Language Settings Tools Macro Run Plugins Window ? LE E > 1 General info.html x form.html x <!X Eile Edit Search View Encoding Language Settings Tools Macro Run Plugins Window ? LE E ODDEN A } form.html x process.php X

//COMMENT DOWN FOR ANY QUERIES...
//HIT A THUMBS UP IF YOU DO LIKE IT!!!

Add a comment
Know the answer?
Add Answer to:
12. Suppose you are going to make an online questionnaire to collect information of current trend...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You need to implement a web application that is split in three parts, namely, Webpage, PHP...

    You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge. PHP Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name"). The function should be able to read the...

  • You need to implement a web application that is split in three parts, namely, Webpage, PHP and My...

    You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge. PHP Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name"). The function should be able to read the...

  • üodlö) Could you please write the instructions step by step to do this problem? Retrieve the...

    üodlö) Could you please write the instructions step by step to do this problem? Retrieve the subpage lo web server: 172.16.219.10), Telnet to this web server and type in a HTTP request. In your request, specify the given header information as follows: bwork1.php with a HTTP request from the web server (IP address of the . User_Agent: Your student ID . Connection: Your name surname If you successfully retrieve the given page, you will get a response similar to this...

  • Create a list of several elements you think should make up a login page. Make sure to obtain instructor approval for the...

    Create a list of several elements you think should make up a login page. Make sure to obtain instructor approval for the elements of your login page. Consider the execution flow to capture the user interaction. Execute this assignment according to the following guidelines: 1.In MySQL, build the necessary tables to store the information required during the log in process. 2.In PHP, write the functions that will enable the capturing of user input and store in the database. 3.In HTML,...

  • Develop an HTML form that could be used to enter your book information (Books, Authors, and...

    Develop an HTML form that could be used to enter your book information (Books, Authors, and Publishers) start with the HTML/JavaScript template provided Expand upon it! What field information would you enter into a system? Have your form use more then just character text fields ... radio buttons, pick lists, and other elements make your form easier to use and you don't need to do lots of JavaScript checks. What fields would be mandatory ... which could be left blank?...

  • In this assignment you will combine HTML, PHP, and SQL in order to create a web...

    In this assignment you will combine HTML, PHP, and SQL in order to create a web form that allows a manager to add films to the sakila database. You will also create a method to allow the manager to view a list of all films along with their related information, and a list of actors in the movies. Task 1 Create an initial HTML page titled manager.html with 2 buttons. The first button will be labeled “View Films”, and the...

  • Create an HTML5 page that contains a form to collect the following data. The text in...

    Create an HTML5 page that contains a form to collect the following data. The text in bold indicates the id value that should be assigned to each html control: Product (drop down list) product – iPad, iPhone 6S, Galaxy 5S, Moto X, and so on Quantity (number) quantity Unit price (number) unit_price Discount (%)(number) discount_rate Date (date)   order_date First Name (text box)   first_name Last Name (text box)   last_name Payment type (drop down list)   payment_type – Visa, Master, Discover, Amex, and...

  • Project Description In this project, you will design and implement a database for keeping track of...

    Project Description In this project, you will design and implement a database for keeping track of information for an online “SOCIAL NETWORK” system (e.g. a simplified version of Facebook!). You will first design an EER schema diagram for this database application. Then, you will map the EER schema into a relational database schema and implement it on ORACLE or MySQL or some other relational DBMS. Finally, you will load some data into your database (via user Interface) and create some...

  • Form Processing HTML One of the most ubiquitous uses of JavaScript is validating form data on...

    Form Processing HTML One of the most ubiquitous uses of JavaScript is validating form data on the client side before it is submitted to the server. It is done everywhere because it is fast and it gives you a great deal of flexibility in how you handle errors insofar as the GUI is concerned. Attached is an image of some code I wrote (so Blackboard can't mess it up). Some things to notice that will help you with the lab....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT