mindapolis Posted November 6, 2011 Share Posted November 6, 2011 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> Quote Link to comment Share on other sites More sharing options...
trq Posted November 6, 2011 Share Posted November 6, 2011 It's saying the id "order" is already somewhere else in the document. Quote Link to comment Share on other sites More sharing options...
mindapolis Posted November 6, 2011 Author Share Posted November 6, 2011 yes, but only in the css and the submit button value Quote Link to comment Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 I'm not sure what your reply refers to. But you can only use IDs once on a page. View the page source (HTML output) of your page, and do a search for the ID in question - you have to elements with the same ID. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.