Jump to content

understanding validator message


mindapolis

Recommended Posts

With the following code why is the validator saying this? 

 

    Line 45, character 14:

 

    <table id = "order"> 

                ^

 

    Error: ID order already defined

    Line 25, character 14:

 

    <table id = "order"> 

                ^

 

    ID order first defined here

 

<?php
session_start();
if (isset($_SESSION['cart'])){
foreach ($_SESSION['cart'] as $key => $value){
//echo "Product Number $key Quantity $value<br />";
}
}
require_once("functions.php");
DatabaseConnection(); 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ordering doggy treats</title>
<link href="doggyTreats.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#order {

margin-right: auto;
margin-left: auto;
}
.orderRow{ 
padding-bottom: 50px;
}
h2 {
text-align: center;
}

</style>
</head>
<body>
  
<?php
$errors=array();
if(isset($_POST['submit'])){
validate_input();
  	}
else {
 	display_form();	
}

function validate_input()
{
	global $errors;
		if($_POST["fname"] == " ")
		{
			$errors['fname']="<span style=\"color:red;\">
			Please enter your first name </span>";
		}
}
        
logo();
navBar();
display_form(); 
extract($_POST);
function display_form() {
global $errors;
?>
<form action="" method="post" name="checkOut">
<table id = "order">   
<caption>Customer Information </caption>
<tr class = "orderRow">
<td> First Name:<br />
     <input name="fname" type="text" size="10" maxlength="20"  />
    </td>  
<td> Last Name: <br />
     <input name="lname" type="text" size="10" maxlength="20" /> 
</td>
<td>    Address: <br />
         <input name="address " type="text"  size="25" /> 
</td>  
</tr>

<tr>
<td> <input name="Submit" type="submit" value="Order Treats!" /></td><td><input name="reset" type="submit" value="Cancel Order" /> </td>
</tr>
</table>
</form>
<?php
}
footer();
?>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/250542-understanding-validator-message/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.