Jump to content

[SOLVED] Can someone help with this echoing problem


ballhogjoni

Recommended Posts

This is my code that pulls the info from the db, but it seems like the code cant print the info from the db. Basically it acts as if my comments column is empty after it finds out its not empty.

 

if (!empty($row['comments'])) {
		echo '<p align="center">';
			echo '<table align="center" width="800">';
				echo '<tr>';
					echo '<td align="center">';
						echo '<form action="" method="post">';
							echo '<table border="1">';
								echo '<tr>';
									echo '<td align="center" colspan="8">';
										echo '<b>Only Choose One Disposition</b>';
									echo '</td>';
								echo '</tr>';
								echo '<tr>';
									echo '<td align="center" width="100">';
										echo 'Too Small<br><input type="checkbox" name="too_small" value="Too Small">';
									echo '</td>';
									echo '<td align="center" width="100">';
										echo 'Money<br><input type="checkbox" name="money" value="Money">';
									echo '</td>';
									echo '<td align="center" width="100">';
										echo 'Time<br><input type="checkbox" name="time" value="Time">';
									echo '</td>';
									echo '<td align="center" width="100">';
										echo 'Not Interested<br><input type="checkbox" name="not_inter" value="Not Interested">';
									echo '</td>';
									echo '<td align="center" width="100">';
										echo 'Client<br><input type="checkbox" name="client" value="Client">';
									echo '</td>';
									/*echo '<td align="center" width="100">';
										echo 'Demo<br><input type="checkbox" name="demo" value="Demo">';
									echo '</td>';*/
									echo '<td align="center" width="100">';
										echo 'Not Contacted<br><input type="checkbox" name="notContacted" value="Not Contacted">';
									echo '</td>';
									echo '<td align="center" width="100">';
										echo 'Call Back<br><input type="checkbox" name="callBack" value="Call Back">';
									echo '</td>';
								echo '</tr>';
								echo '<tr>';
									echo '<td align="center" colspan="8">';
									echo '<textarea name="comments" cols="70" rows="5">'.$row['commments'].'</textarea>';
									echo '</td>';
								echo '</tr>';
								echo '<tr>';
									echo '<td align="center" colspan="8">';
										echo '<input type="submit" value="Submit Your Disposition">';
									echo '</td>';
								echo '</tr>';
							echo '</table>';
						echo '</form>';
					echo '</td>';
				echo '</tr>';
			echo '</table>';
		echo '</p>';
}

Why all the echos?? There is no need to complicate code like that. Try this instead.

 

<?php 
if (!empty($row['comments'])) { 
?>

<p align="center">
<table align="center" width="800">
	<tr>
		<td align="center">
			<form action="" method="post">
				<table border="1">
					<tr>
						<td align="center" colspan="8">
							<b>Only Choose One Disposition</b>
						</td>
					</tr>
					<tr>
						<td align="center" width="100">
							Too Small<br><input type="checkbox" name="too_small" value="Too Small">
						</td>
						<td align="center" width="100">
							Money<br><input type="checkbox" name="money" value="Money">
						</td>
						<td align="center" width="100">
							Time<br><input type="checkbox" name="time" value="Time">
						</td>
						<td align="center" width="100">
							Not Interested<br><input type="checkbox" name="not_inter" value="Not Interested">
						</td>
						<td align="center" width="100">
							Client<br><input type="checkbox" name="client" value="Client">
						</td>
						<td align="center" width="100">
							Demo<br><input type="checkbox" name="demo" value="Demo">
						</td>
						<td align="center" width="100">
							Not Contacted<br><input type="checkbox" name="notContacted" value="Not Contacted">
						</td>
						<td align="center" width="100">
							Call Back<br><input type="checkbox" name="callBack" value="Call Back">
						</td>
					</tr>
					<tr>
						<td align="center" colspan="8">
						<textarea name="comments" cols="70" rows="5"><?=$row['comments']?></textarea>
						</td>
					</tr>
					<tr>
						<td align="center" colspan="8">
							<input type="submit" value="Submit Your Disposition">
						</td>
					</tr>
				</table>
			</form>
		</td>
	</tr>
</table>
</p>

<?php } ?>

 

PHP is nice because you can drop in and out of it most anywhere.

 

 

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.