Create an HTML form that works for the following php file. Email $formEmailAddress ";    echo "Topic $formTopic "; ?> contact form response      This page was created by PHP on the server and sent back to your browser. "; //It will create a table and display one set of name value pairs per row    echo "";    echo "Field NameValue of field";    foreach($_POST as $key => $value)    {        echo '';        echo '',$key,'';        echo '',$value,'';        echo "";    }    echo "";    echo " ";    $toEmail = "email";       //will send the email to the email address entered on the form              $subject = "Thank you for your message. I will contact you soon.";   //This is the message that will be sent back to the person who sent you a message from your contact form.       $fromEmail = "address";          $emailBody = "Form Data\n\n ";              foreach($_POST as $key => $value)          {        $emailBody.= $key."=".$value."\n";   //Adds the name value pairs to the body of the email, each one on their own line    }       echo "$emailBody";       $headers = "From: $fromEmail" . "\r\n";               //Creates the From header with the appropriate address     if (mail($toEmail,$subject,$emailBody,$headers))    //puts pieces together and sends the email to your hosting account's smtp (email) server    {         echo("Message successfully sent!");    }    else    {         echo("Message delivery failed...");    } ?>

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Create an HTML form that works for the following php file.

<?php

   $formEmailAddress = $_POST['email'];   //pull email address from the form data
   $formTopic = $_POST['topic'];           //pull topic from the form data
  
   echo "<h1>Email $formEmailAddress </h1>";
   echo "<h1>Topic $formTopic </h1>";

?>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>contact form response</title>
<style type="text/css">
#container {
           width: 800px;
           border: 1px solid black;
           padding: 10px;
           margin: 10px auto;
           }
.colorRed {
   color: #F00;
}
</style>
</head>

<body>
<div id="container">

  
<hr>
<p>&nbsp;</p>

<?php

echo "<p class='colorRed'>This page was created by PHP on the server and sent back to your browser. </p>";

//It will create a table and display one set of name value pairs per row
   echo "<table border='1'>";
   echo "<tr><th>Field Name</th><th>Value of field</th></tr>";
   foreach($_POST as $key => $value)
   {
       echo '<tr class=colorRow>';
       echo '<td>',$key,'</td>';
       echo '<td>',$value,'</td>';
       echo "</tr>";
   }
   echo "</table>";
   echo "<p>&nbsp;</p>";

   $toEmail = "email";       //will send the email to the email address entered on the form
      
  
   $subject = "Thank you for your message. I will contact you soon.";   //This is the message that will be sent back to the person who sent you a message from your contact form.

  
   $fromEmail = "address";      


   $emailBody = "Form Data\n\n ";          
   foreach($_POST as $key => $value)      
   {
       $emailBody.= $key."=".$value."\n";   //Adds the name value pairs to the body of the email, each one on their own line
   }
  
   echo "<h2>$emailBody</h2>";
  
   $headers = "From: $fromEmail" . "\r\n";               //Creates the From header with the appropriate address

    if (mail($toEmail,$subject,$emailBody,$headers))    //puts pieces together and sends the email to your hosting account's smtp (email) server
   {
        echo("<p>Message successfully sent!</p>");
   }
   else
   {
        echo("<p>Message delivery failed...</p>");
   }

?>

</body>
</html>

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY