no idea - that's what i thought too - i'm not a php programmer and i just screwed around with it til it seemed to work event though it doesn't make any sense programmatically ;-)
can you help me get this together?
Main Topics
Browse All Topicsi've already thought i had the answer a couple of times but , alas, i'm still finding some formatting quirks
i need the following code to turn out a format exactly like this - if any field is empty i need to get rid of the resulting extra space. this is how i need it formatted:
Title<br>
Subtitle
<p>Date<br>
Author
what's happening alot is the Subtitle and Date are missing so an extra space is created or there's no date and an extra space is created. here's my code (thanks in advance for the help)
<p> <b><?php echo $row_rsSigCases['Title']; ?></b>
<?
if(!empty($Subheader)) {
echo "<p>" . $row_rsSigCases['Subheader
}
else {
echo "<br><I>" . $row_rsSigCases['Subheader
}
?>
<?
if(!empty($ArtDate)) {
$dataArray[] = $row_rsSigCases['ArtDate']
}
else {
$dataArray[] = $row_rsSigCases['ArtDate']
}
?>
<?
if(!empty($Author)) {
$dataArray[] =$row_rsSigCases['Author']
}
else {
$dataArray[] = $row_rsSigCases['Author'];
}
echo "<P>";
for($no=0;$no<count($dataA
echo $dataArray[$no]."<br>";
}
;
?>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi, just remove ELSE part. That means if eg. date is empty you don't set variable or you don't print out any code.
so for subheader would look like this.. If there is subheader you print it out otherwise nothing is printed...
if(!empty($Subheader)) {
echo "<p>" . $row_rsSigCases['Subheader
}
same for dataarray
if(!empty($Author)) {
$dataArray[] =$row_rsSigCases['Author']
}
cheers
thanks for the help folks - i'm almost there - only bug is when a ArtDate is actually in the record i need a <p> in front of it. BUT when ArtDate is not there, it looks fine.
listed below is my current code followed by the URL to the problem formatting page (notice the date - when the date is listed i need:
Title (or Subheader)
<p>ArtDate<br>
Author
not
Title (or Subheader)
<br>ArtDate
<p>Author
Problem URL:
http://72.29.64.29/~raynes
Code:
<?
if(empty($Publication)) {
echo "<p><b>" . $row_rsSigCases['Publicati
}
?>
<p> <b><?php echo $row_rsSigCases['Title']; ?></b>
<?
if(empty($Subheader)) {
echo "<br><I>" . $row_rsSigCases['Subheader
}
?>
<?
if(empty($ArtDate)) {
$dataArray[] = $row_rsSigCases['ArtDate']
}
?>
<?
if(empty($Author)) {
$dataArray[] = $row_rsSigCases['Author'];
}
for($no=0;$no<count($dataA
echo $dataArray[$no]."<p>";
}
?>
ah! there are so many different scenarios here! if i allow for one (i.e. ArtDate and Subheader are empty those look fine)
see:
http://72.29.64.29/~raynes
but if i have a Subheader but ArtDate is empty i get:
http://72.29.64.29/~raynes
(there should be a <p> between Subheader and Author)
here's my most recent code:
<?
if(empty($Publication)) {
echo "<p><b>" . $row_rsSigCases['Publicati
}
?>
<p> <b><?php echo $row_rsSigCases['Title']; ?></b>
<?
if(empty($Subheader)) {
echo "<br><I>" . $row_rsSigCases['Subheader
}
else {
echo "<br>" . $row_rsSigCases['Subheader
}
?>
<?
if(!empty($ArtDate)) {
echo "<br>" . $row_rsSigCases['ArtDate']
}
else {
echo "<br>" . $row_rsSigCases['ArtDate']
}
?>
<?
if(empty($Author)) {
echo $row_rsSigCases['Author'];
}
?>
Well, it's just about how you explicitly want it to look. And I'm not sure what that is; I can only guess right now.
So, here's a guess.
<?php
if(!empty($Publication))
echo "<p><b>" . $row_rsSigCases['Publicati
echo '<p><b>'. $row_rsSigCases['Title'] .'</b>';
if(!empty($Subheader))
echo "<br /><i>" . $row_rsSigCases['Subheader
else
echo '<br /></p>';
if(!empty($ArtDate))
echo '<p>' . $row_rsSigCases['ArtDate']
else
echo '<br />';
if(!empty($Author))
echo $row_rsSigCases['Author'].
?>
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Split between matt_mcswain and gruntar
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
merwetta1
EE Cleanup Volunteer
Business Accounts
Answer for Membership
by: matt_mcswainPosted on 2005-02-21 at 20:23:49ID: 13368807
I'm confused. Why are you doing the same thing for your if's and else's?
; ;
;
if(!empty($ArtDate)) {
$dataArray[] = $row_rsSigCases['ArtDate']
}
else {
$dataArray[] = $row_rsSigCases['ArtDate']
}
?>
Is that not the same statement?
Why not just?
if(!empty($ArtDate)) {
$dataArray[] = $row_rsSigCases['ArtDate']
}
and forget the else.