form data

when i enter the information into the html page and submit nothing happens on my php page. also the table im trying to make with php doesn’t work. the php tags are visible and i don’t know why.

index.html

Carpet Calculator body{ font-family: Arial, Helvetica, sans-serif } #contentPad{ width: 450px; margin: 0 auto; padding: 0px 20px 20px; background: white; border: 2px solid #000080; } h1{ color:#000080; } label{ width: 12em; padding: 2em; } #data input{
		margin-bottom: .5em;	
		
		}
	</style>
</head>

<body>
	<div id="contentPad" align="center">
		<h1 align="center">Carpet Calculator</h1>
		<form action="CarpetDisplay.php" method = "post">
			<div>
				<label for="pad">Pad Costs: </label><br />
				<select name="pad" id="pads" size="1">
					<option value="0.35" >Basic Pad - $0.35 a square foot</option>
					<option value="0.55" >Premium Pad - $0.55 a square foot</option><br />
				</select>
			</div>
			<div id ="data2">
				<label for="carpet">Carpet Costs: </label><br />
				<select name="carpet" id="carpets" size="1">
					<option value="1.25" >Standard Carpet - $1.25 a square foot</option>
					<option value="1.75" >High Quality Carpet - $1.75 a square foot</option>
					<option value="1.95" >Ultra Quality Carpet - $1.95 a square foot</option>
				</select>
			</div>
			<div id="data">
				<label for="width">Width:&nbsp; </label>
				<input type="text" name="width" /><br />
				<label for="width">Length: </label>
				<input type="text" name="length" /><br />
			</div>
			<div>
				<label>&nbsp;</label><br />
				<input type="submit" value="Send Data" /><br />
			</div>
		</form>
	</div>
	
</body>

carpetdisplay.php

<?php //get data from the form $connection = mysql_connect("localhost","web","internet"); $pad_price = $_POST['pad']; $carpet_price = $_POST['carpet']; $calc_width = $_POST['width']; $calc_length = $_POST['length']; //echo 'pad_price = ' . $pad_price; //do calculations for total cost $calc_width = ceil($calc_width); $calc_length = ceil($calc_length); $pad_total = $calc_width * $calc_length * $pad_price; $carpet_total = $calc_width * $calc_length * $carpet_Price; $total = $carpet_total + $pad_total; $total_tax = $total * 1.088; ?> Carpet Calculator #calculators { width: 450px; margin: 0 auto; padding: 0px 20px 20px; background: white; border: 2px solid #000080; } h1 { color:#000080; } label { float: left; }

Carpet Calculator

Pad Price: <?php echo $pad_total;?>
		<label>Carpet Price: </label>
		<span><?php	echo $carpet_total;?></span><br />
		<label>Total: </label>
		<span><?php	echo $total;?></span><br />
		<label>Total Plus Tax:</label> 
		<span><?php echo $total_tax;?></span><br />
				</td>
		<tr>
	</div>
	
	<table border="1">

<$php

	for($row = 1; $row<=$cal_width;$row++){
		echo "<tr>";
			for($col = 1;$col<=$cal_length;$col++){
				echo "<td></td>";
			}
			
	}
	echo "</tr>";

?>

</body>

[php]<?php //get data from the form
$connection = mysql_connect(“localhost”,“web”,“internet”);
//echo 'pad_price = ’ . $pad_price;

     //do calculations for total cost
     $calc_width = ceil($_POST['width']);
     $calc_length = ceil($_POST['length']);
     $pad_total = $calc_width * $calc_length * $_POST['pad'];
     $carpet_total = $calc_width * $calc_length * $_POST['carpet'];
     $total = $carpet_total + $pad_total;
     $total_tax = $total * 1.088;

?>[/php]

[php]<&php

  for($row = 1; $row<=$cal_width;$row++){
     echo "<tr>";
        for($col = 1;$col<=$cal_length;$col++){
           echo "<td></td>";
        }
        
  }
  echo "</tr>";

?>[/php]

Change <&php to <?php

Sponsor our Newsletter | Privacy Policy | Terms of Service