PHP
Can't get my code to work, what am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<script>
</script>
</head>
<body>
<h2>Temperature Conversion Table</h2>
<h4>Enter a starting value in degrees Fahrenheit and an
increment value.</h4>
<form name="myTemp"
onsubmit="convertCelcius()" method="post">
<input type="text" name="temperature"> Enter an value in
degrees Fahrenheit<br><br>
<input type="radio" name="degIncrement" id="degIncrement5">
Convert in increment in 5 degrees<br>
<input type="radio" name="degIncrement" id="degIncrement10">
Convert in increment in 10 degrees
<br/><br/><input type="submit"
value="Submit">
</form>
<?php
if( $_POST["temperature"] || $_POST["degincrement"] ) {
//get he increament value and temperature from post
request
$degincrement = $_POST['increment'];
$temperature = $_POST['temperature']
//html table
echo "<table>";
// Create Table header
echo "<tr>";
echo "<th>Temperature(F)</td>";
echo "<th>Temperature(C)</th>";
echo "</tr>";
// For loop to increament the temperature and print the table
row
for($temp_in_fahrenheit = $temperature; $temp_in_fahrenheit <
$temperature + 100; $temp_in_fahrenheit = $temp_in_fahrenheit +
$increment) {
echo "<tr>";
//calculate temperature in celcius
$temp_in_celcius = ($temp_in_fahrenheit - 32) / 1.8;
//tempereature in fahrnheit
echo "<td>" . $i . "</td>";
//temperature in celcius
echo "<td>" . $temp_in_celcius . "</td>";
echo "</tr>";
}
echo "<table>";
exit();
}
?>
</body>
</html>
Here is what the out put should look like.
Hi, Uploading files of HTML and PHP in two seperate files please find code below
Output:
Source code for
copying:
form.html
<!--form.html-->
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<H1>Temperature Conversion Table</H1>
<form action="temp.php" method="post">
<p>Enter a starting value in degrees Fahranheit and an
increment value.</p>
<input type="number" name = "Fahranheit">
<label>Enter a value in degree
Fahranheit</label><br>
<label>Convert in increments of 5 degrees</label>
<input type="radio" name="increment"
value="5"><br>
<label>Convert in increments of 10 degrees
</label>
<input type="radio" name="increment"
value="10"><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
temp.php
<!--temp.php-->
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<H1>Temperature Conversion Table</H1>
<table style="width:50%;border:solid 1px">
<tr>
<th>Degress Fahranheit</th>
<th>Degress Celcius</th>
</tr>
<?php
$f = $_POST["Fahranheit"];
$i = $_POST["increment"];
$final_f = $f+100;
while($f <= $final_f)
{
?>
<tr >
<td style="text-align:center;border:solid 1px;"><?php echo
$f; ?></td>
<td style="text-align:center;border:solid 1px;"><?php echo
($f-32)/1.8; ?></td>
</tr>
<?php
$f+=$i;
}
?>
</table>
</body>
</html>
PHP Can't get my code to work, what am I doing wrong? <!DOCTYPE html> <html> <head>...
Hey Guys I am doing a project and need some help with code in HTML and PHP. I need a form made in HTML that can be sent to a specific email through PHP. For some reason the info is not getting sent to my email, even though it says that it was sent. I have some source code here: <?php if(isset($_POST['submit'])) { $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $message = $_POST['message']; $email = mail('MY_EMAIL', $subject, $message,...
How can I print the Database table in PHP please ? here I have form for name and email, also I have php code that allow user to add his name and email to my database, all I need to print my final database when the user click on submit. <form action="" method="post"> <label>Name :</label> <input type="text" name="name" required="required" placeholder="Please Enter Name"/><br /><br /> <label>Email :</label> <input type="email" name="email" required="required" /><br/><br /> <input type="submit" value=" Submit " name="submit"/><br /> </form>...
Q1. rewrite the exercise on April 4 by adding the
following operations:
1) In the php script, create an associative array named
$order that stores the following values:
- the number of cheese toppings;
- the number of pepperoni toppings;
- the number of
ham
toppings;
- the size of the ordered pizza;
- the number of the ordered pizza;
- the total cost of the order;
- the discount rate;
- the total cost after the discount.
2) the...
Both codes <!DOCTYPE html> <html> <head> <title>Week 8 Lab - JavaScript DOM and Arrays</title> <meta charset="utf-8"> </head> <body> <h2>Order Form</h2> <form name="orderForm" method="post" action="processForm.html"> <table> <tr> <th colspan="2">Personal Information</th> </tr> <tr> <td>First Name:</td> <td><input type="text" name="firstName" id="firstName" size="30"></td> </tr> <tr> <td>Last Name:</td> <td><input type="text" name="lastName" id="lastName" size="30"></td> </tr> <tr> <td>Address:</td> <td><input type="text" name="address" id="address" size="30"></td> </tr> <tr> <td>City:</td> <td><input type="text" name="city" id="city" size="30"></td> </tr> <tr> <td>Province:</td> <td><select name="province" id="province" size="1"> <option disabled>Select a province</option> <option value="BC">British Columbia</option> <option value="AB">Alberta</option> <option...
i'm having trouble with 1 and 3 using html, javascript and jquery 1) Change the "Search" link on the left to a button that when clicked, hide all the fields on the form and display the text "This is a search feature..." 3) When the user fills the form and clicks "Login", the values inputted should be displayed in the empty row (under Login) of the page. The display should be in the form: Student ID: <input value> Student Name:...
How to make all the buttons work using javascript? <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script> function openAccount() { /* - get the account and initial amount values - check that all necessary information is provided - call the setCookie function to create account */ } function Deposit() { /* - get the account and amount values - check that all necessary information is provided - alter cookie with current amount of deposit */ } function...
Im working with php but having problem displaying the correct result. I need to show Order processed at (time) HTML file: <!DOCTYPE html> <html> <head> <title>Bob's Auto Parts - Order Form</title> </head> <body> <form action="processorder.php" method="post"> <table style="border: 0px;"> <tr style="background: #cccccc;"> <td style="width: 150px; text-align: center;">Item</td> <td style="width: 15px; text-align: center;">Quantity</td> </tr> <tr> <td>Tires</td> <td><input type="text" name="tireqty" size="3" maxlength="3" /></td> </tr> <tr> <td>Oil</td> <td><input type="text" name="oilqty" size="3" maxlength="3" /></td> </tr> <tr> <td>Spark Plugs</td> <td><input type="text" name="sparkqty" size="3" maxlength="3" /></td>...
Hello, I was wondering if someone could help me with this PHP and HTML problem. Basically, there is code for a multiplication table and i need to change it to support the following. Make the page background (not table background) to change among three colors of your choice. Use the drop-down list to specify the size of the multiplication table to be 8, 10, 12, and 14 Put the multipliers in the first column and the multiplicand on the first...
Below is the code created for a previous assignment. I now need to create functions to validate the name, age, and item selection in an external JavaScript file. Specifically, check for the following: The user has entered a name Age is a number between 18 and 110 An item is selected Ensure that a handler returns true if the input is acceptable and false otherwise. Add an onSubmit attribute to the form tag so that a validation failure prevents the...
PHP, HTML
I have this code in the picture below for a guess game.