Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

To your order form from Part 3, add input elements for customer name and address

ID: 650886 • Letter: T

Question

To your order form from Part 3, add input elements for customer name and address if they're not already there. The "state" part of the address must be a select list (also called a "pulldown menu") to allow the person placing the order to choose his or her state. Don't type all fifty states, but supply at least Georgia, Alabama and Florida. Put the names of the states in an PHP array and use PHP code to create the drop-down dynamically. (This will still be named l7p3.php; you're just adding to something you've already tested.)

Explanation / Answer

<?php //here handling form ..printing the form entered values
if( $_POST["customername"] || $_POST["address"] ||$_POST["state"] )
{
echo "Welcome ". $_POST['customername']. "<br />";
echo "You entered Address ". $_POST['address']. "<br />";
echo "You entered state ". $_POST['state'];
exit();
}
?>
<html>
<body>
<form action="<?php $_PHP_SELF ?>" method="POST">
<h1>Order Form</h1>
Customer Name: <input type="text" name="customername" />
Address: <input type="text" name="address" />
<?php //here we are declaring statee array and feed into select option
$states =array("select state","Georgia", "Alabama", "Floroda");

echo "<select name=state>";

for($i=0; $i < count($states); $i++)
echo "<option value=". $states[$i] .">" . $states[$i] . "</option>";//printing states into select options
echo "</select>";
?>
<input type="submit" />
</form>
</body>
</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote