Question

How can I connect the html forms to php --> mysql database <!DOCTYPE html> <html lang="en">...

How can I connect the html forms to php --> mysql database

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>

<h2> <center> Average: </h2>
<h3> <center> Rate the following: </h2>
<h3>
<center> Rating Criteria:
<br> Developing (0-5), Competent (6-10), Accomplished (10-15);

</h3>

<center> Judge Name: <input type="text" id="judge">
<br>
<br>

<center> 1. Articulate requirements and design of the project: <input type="text" id="num1">
<br>
<br>

2. Plan the solution and implement the project: <input type="text" id="num2">
<br>
<br>

3. Choose appropriate tools and methods for each task: <input type="text" id="num3">
<br>
<br>

4. Give clear and coherent oral presentation: <input type="text" id="num4">
<br>
<br>

5. Use allocated time for presentation efficiently: <input type="text" id="num5">
<br>
<br>

6. Functions well as a team: <input type="text" id="num6">
<br>
<br>

<label for="comment">Comments:</label>
<br>
<br>
<textarea id="comments" rows="4" cols="100">

</textarea>

<br>
<br>


<button onclick="calculate()"> Submit </button>

<h3 id="answer"></h3>

<script>


function calculate()
{
var field1=document.getElementById("num1").value;
var field2=document.getElementById("num2").value;
var field3=document.getElementById("num3").value;
var field4=document.getElementById("num4").value;
var field5=document.getElementById("num5").value;
var field6=document.getElementById("num6").value;

var result= (parseInt(field1) + parseInt(field2) + parseInt(field3) + parseInt(field4) + parseInt(field5) + parseInt(field6)) / 6 ;
document.getElementById("answer").innerHTML="The average is for this project is " + result;
}


</script>

</body>
</html>

0 0
Add a comment Improve this question Transcribed image text
Answer #1
 <!DOCTYPE html> <html> <head> <title>Form site</title> </head> <body> <form method="post" action="connect.php"> Username : <input type="text" name="username"><br><br> Password : <input type="password" name="password"><br><br> <input type="submit" value="Submit"> </form> </body> </html> 

Enter your full html form code in at the place of above code .

Use form tag to create form if you want I will done that also for you if you provide details about that.

How can I connect the html forms to php --> mysql database

use foolowing php code to connect your html form with database it definitely works

 <?php $username = filter_input(INPUT_POST, 'username'); $password = filter_input(INPUT_POST, 'password'); if (!empty($username)){ if (!empty($password)){ $host = "localhost"; $dbusername = "root"; $dbpassword = ""; $dbname = "youtube"; // Create connection $conn = new mysqli ($host, $dbusername, $dbpassword, $dbname); if (mysqli_connect_error()){ die('Connect Error ('. mysqli_connect_errno() .') ' . mysqli_connect_error()); } else{ $sql = "INSERT INTO account (username, password) values ('$username','$password')"; if ($conn->query($sql)){ echo "New record is inserted sucessfully"; } else{ echo "Error: ". $sql ." ". $conn->error; } $conn->close(); } } else{ echo "Password should not be empty"; die(); } } else{ echo "Username should not be empty"; die(); } ?>
Add a comment
Know the answer?
Add Answer to:
How can I connect the html forms to php --> mysql database <!DOCTYPE html> <html lang="en">...
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
  • <!DOCTYPE html> <html> <head> <!-- JavaScript 6th Edition Chapter 4 Hands-on Project 4-3 Author: Da...

    <!DOCTYPE html> <html> <head> <!-- JavaScript 6th Edition Chapter 4 Hands-on Project 4-3 Author: Date:    Filename: index.htm --> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Hands-on Project 4-3</title> <link rel="stylesheet" href="styles.css" /> <script src="modernizr.custom.05819.js"></script> </head> <body> <header> <h1> Hands-on Project 4-3 </h1> </header> <article> <div id="results"> <p id="resultsExpl"></p> <ul> <li id="item1"></li> <li id="item2"></li> <li id="item3"></li> <li id="item4"></li> <li id="item5"></li> </ul> </div> <form> <fieldset> <label for="placeBox" id="placeLabel"> Type the name of a place, then click Submit: </label> <input type="text" id="placeBox"...

  • I have some code for HTML/Javascript but I need to change it up a bit. Heres...

    I have some code for HTML/Javascript but I need to change it up a bit. Heres the assignment and what I have. The part in the bold is what I need help with. I need a button called new timer for when it reaches zero... Thank you. Assignment For this assignment, you will write a timer application in HTML and JavaScript. Your HTML document should contain the following elements/features: HTML tags: An <input> tag labeled "Timer Duration" with the initial...

  • in the following java script code follow the instructions provided <!DOCTYPE html> <html> <head> <!-- JavaScript...

    in the following java script code follow the instructions provided <!DOCTYPE html> <html> <head> <!-- JavaScript 6th Edition Chapter 5 Hands-on Project 5-2 Author: Date:    Filename: index.htm --> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Hands-on Project 5-2</title> <link rel="stylesheet" href="styles.css" /> <script src="modernizr.custom.05819.js"></script> </head> <body> <header> <h1> Hands-on Project 5-2 </h1> </header> <article> <h2>Change of address form</h2> <form> <fieldset id="contactinfo"> <label for="addrinput"> Street Address </label> <input type="text" id="addrinput" name="Address" /> <label for="cityinput"> City </label> <input type="text" id="cityinput" name="City"...

  • NEED HELP with HTML with Javascript embedding for form validation project below. I have my code...

    NEED HELP with HTML with Javascript embedding for form validation project below. I have my code below but I'm stuck with validation. If anyone can fix it, I'd really appreciate. ****************************************************************************** CODE: <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Nice</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> var textFromTextArea; function getWords(){ var text =...

  • I am trying to make it so that radio buttons when clicked execute a javascript file....

    I am trying to make it so that radio buttons when clicked execute a javascript file. I have to to have the exercises in external files. Here is what I have so far. I am reusing a script that was used to make radio buttons switch CSS files so I think I have to change the set attribute options. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <p> 4.2 Output: The first 20 Fibonacci numbers, which are...

  • Please advise what is being doing wrong. Requirement. See if you can modify the code of...

    Please advise what is being doing wrong. Requirement. See if you can modify the code of Listings 17.1 and 17.3 to present a message to the user while waiting for an Ajax request to complete. //Code <!DOCTYPE html> <html> <head> <title>Keywords Grabber</title> <script src="myAjaxLib.js"></script> <script> function display(content) { document.getElementById("displaydiv").innerHTML = content; </script> <script> function getXMLHttpRequest() { try { try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { return new ActiveXObject("Msxml2.XMLHTTP"); } } catch(e) { return new XMLHttpRequest(); } } function doAjax(url,...

  • Create an HTML form that takes these inputs: Number of rows, and number of columns. This...

    Create an HTML form that takes these inputs: Number of rows, and number of columns. This form will submit to a PHP page. Create that page that will accept input from the HTML form and generates the table from the user's input. I already have the portion that generates the table based on user input by using Javascript in an HTML page, I just need to know how to generate the table using a PHP page instead. Here's the code...

  • Add comments to it by filling in the blank comments numbers 1 through 32. (The first...

    Add comments to it by filling in the blank comments numbers 1 through 32. (The first few comments are HTML comments, not JavaScript comments, and are bracketed according to <!- this is an HTML comment>.) <!DOCTYPE html> <html> <body onload="handleFormAction()"> <h2>Form handling example in JavaScript</h2> <h3>(Or, John Doe meets Robbie Robot)</h3> <h4>Instructions: Fill in the form. Then fill in comments 1 through 23 in the JavaScript code!</h4> <form target="_blank" action= > <!- 1: replace this placeholder HTML comment with a...

  • LANGUAGE JAVASCRIPT, PHP Need help with PHP and ajax code. The user needs to login but,...

    LANGUAGE JAVASCRIPT, PHP Need help with PHP and ajax code. The user needs to login but, I keep getting an error that I coded "Wrong username and password!" ***PLEASE DONT GIVE ME A NEW CODE THAT IS NOWHERE NEAR THE CODE I SUBMITTED***** PLEASE LOOK AT THE CODE AND SEE ANY ISSUES login.html <!DOCTYPE html> <html> <head> <title>login popup</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <style type="text/css"> body { background-color: white; } </style> </head> <body> <center> <h1 style="text-align: center;"> Login </h1> <form>             Login ID:...

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
ADVERTISEMENT