Question

using PHP.... the code below is a shipping form that has one input text type to...

using PHP....

the code below is a shipping form that has one input text type to enter the "package weight",

destination with a select tag that has the option for New York or Out of State,

insurance option with two radio buttons. radio value "yes" has a $10.00 insurance fee, and the no option has no fee,

a submit button .

all information is within a form with a method ="post" and an action ="<?php echo $_SERVER['PHP_SELF']; ?>

<html>
<head>
<title></title>

</head>
<body>

<div id="contentwrap">

   <div id="heading">Turtle Speed Pakcage Delivery Service</div>
  
   <div id="formdiv">
      
       <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  
           <div class="formtext">Enter package weight (lbs)</div>
           <div><input type="text" class="formfield" name="weight" /></div>
          
           <div class="formtext">Select Destination</div>
           <select class="formfield" style="width:280px;" name="dest">
               <option value="ny">New York</option>
               <option value="out">Out of State</option>
           </select>
          
           <div class="formtext">Insurance</div>
           <div><input type="radio" name="insurance" value="yes"/>Yes ($10.00 extra)</div>
           <div><input type="radio" name="insurance" value="no" checked />No</div>
      
           <div style="margin-top:10px;">
               <input type="submit" value="Submit Order" id="orderbutton">
           </div>
      
       </form>
          
       <?php
       // your PHP code goes here You may not alter the form above in anyway
      
      
       ?>

  
   </div> <!-- ends div#formdiv -->
      
</div> <!-- ends div#contentwrap -->

</body>
</html>

when user inputs a weight number, let below equal the weight price.

0 - 25 lbs = $15.00

26 - 50 lbs = $25.00

51lbs + = $40.00

output must include:

show output results under the submit button after form has been filled out.

"Results of your package:

package weight: inputed weight

base cost of package depending on weight: price

destination: destination selected

insurance option: yes or no if yes please include $10.00

total price of order: total price which includes the inputed information and options selected"

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

Code

<html>
<head>
<title></title>

</head>
<body>

<div id="contentwrap">

<div id="heading">Turtle Speed Pakcage Delivery Service</div>
  
<div id="formdiv">
  
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  
<div class="formtext">Enter package weight (lbs)</div>
<div><input type="text" class="formfield" name="weight" /></div>
  
<div class="formtext">Select Destination</div>
<select class="formfield" style="width:280px;" name="dest">
<option value="ny">New York</option>
<option value="out">Out of State</option>
</select>
  
<div class="formtext">Insurance</div>
<div><input type="radio" name="insurance" value="yes"/>Yes ($10.00 extra)</div>
<div><input type="radio" name="insurance" value="no" checked />No</div>
  
<div style="margin-top:10px;">
<input type="submit" value="Submit Order" id="orderbutton">
</div>
  
</form>
  
<?php
           if ($_SERVER['REQUEST_METHOD'] === 'POST')
           {
               $weight=$_POST['weight'];
               $destination=$_POST['dest'];
               $insurance=$_POST['insurance'];
               $baseCost=0.0;
               $totalCost=0;
               if($weight>=0 && $weight<=25)
                   $baseCost=15.00;
               else if($weight>=26 && $weight<=50)
                   $baseCost=25.00;
               else
                   $baseCost=40.00;
              
               $totalCost=$baseCost;
              
               if($insurance=="yes")
                   $totalCost+=10;
              
               echo "Package weight: ".$weight." lbs</br>";
               echo "Base cost of package $".$baseCost."</br>";
               echo "Destination: ".$destination."</br>";
               echo "Insurance : ".$insurance."</br>";
               echo "Total price of order: $".$totalCost."</br>";
           }      
?>
  
</div> <!-- ends div#formdiv -->
  
</div> <!-- ends div#contentwrap -->

</body>
</html>

output

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
using PHP.... the code below is a shipping form that has one input text type to...
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
  • PHP code that is given : <?php // Here is where your preprocessing code goes //...

    PHP code that is given : <?php // Here is where your preprocessing code goes // An example is already given to you for the First Name $fname = $_GET['fname']; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Exercise 2 - GET Echo</title> <style> body { margin:0; padding:0; font-family: Arial; } form { margin:20px; } input[type="text"], input[type="password"] { width:150px; padding:3px; font-size:1em; } input[type="submit"] { padding:3px; font-size:1em; } label { display:inline-block; width:150px; } .input-container { padding:5px; } </style> </head> <body> <form...

  • PHP, HTML I have this code in the picture below for a guess game.

    PHP, HTML I have this code in the picture below for a guess game.

  • 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:...

  • PHP Can't get my code to work, what am I doing wrong? <!DOCTYPE html> <html> <head>...

    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...

  • Write a PHP program using a ''FOR loop' to compute and print the employee's salary for...

    Write a PHP program using a ''FOR loop' to compute and print the employee's salary for some number of years with a percent increase each year. Your submit button should re-call this page and use PHP to create a table of salaries for each year starting at 1 up to the value of the years variable. So if 'years' is equal to 5, there should be 5 rows in your table. For each year, the salary increases by X%. Make...

  • 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...

    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>...

  • PHP - Use of classes This is a further development of the previous task, the participant...

    PHP - Use of classes This is a further development of the previous task, the participant registration. You must use the following Participant class. <?php class Deltaker { private $etterNavn; private $forNavn; private $fAar; function __construct(string $fornavn, string $etternavn, string $aar) { $this->forNavn = $fornavn; $this->etterNavn = $etternavn; $this->fAar = $aar; } function hentEtterNavn() : string { return $this->etterNavn; } function hentForNavn() : string { return $this->forNavn; } function hentFAar() : string{ return $this->fAar; } //Setters function settForNavn(string $fornavn) {...

  • Using form events functions to answer this question. Use the attached form html file which contains...

    Using form events functions to answer this question. Use the attached form html file which contains 2 html radio buttons. When the first choice is chosen, display the text ”First” under the first choice. When the second choice is chosen, display the text ”Second” under the second choice. Instead of using JavaScript complete this question using JQuery <!DOCTYPE html> <html> <head>     <title>midterm exam</title>     <link rel="stylesheet" href="css/q1.css" /> </head> <body>     <div id = "page">        <form>   ...

  • This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName...

    This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName ContactName Address City PostalCode Search O ASC DESC List All Records Insert Record Country List City CustomerName ContactName Address City PostalCode Country List City Find by IID Find Insert 1 <! DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http:L 3-<head> 4 Kmeta http-equiv-"Content-Type" content-"text/html; charset-utf-8" />...

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