ajaxForm 500 Internal Server Error - php

Hi im making an ajaxForm using comments.My problem is why the error is 500 Internal Server Error???, Well my codes and js library are in there, i dont quite understand why 500 internal server error.. Here's my code below.
<script>
$(document).ready(function(){
$("#tbl_comments").hide();
//$("#loading").hide();
$("#ptxt_green").hide();
$('#comment_form').ajaxForm({
target: '.result',
beforeSubmit: validate,
success: function(data) {
alert(data);
}
});
$("#loading")
.hide()
$(".result").show()
.ajaxStart(function(){
$(this).show();
$(".result").hide();
$("#loading").show();
})
.ajaxStop(function(){
$(this).hide();
$(".result").show();
})
;
});
function validate(){
var comment = $('textarea[name=txt_comment]').fieldValue();
if(!comment[0]){
$("#ptxt_green").fadeIn();
$("#ptxt_green").fadeOut(3000);
return false;
}
}
</script>
<?php $sf_response->setTitle(myTitleFactory::getPageTitle('seminar_detail', 'frontend',array('%seminar_title%'=>$seminar->getTitle())));?>
<?php myTools::loadBreadSlot(array(
myBreadcrumbFactory::get('seminar-list', 'frontend'),
myBreadcrumbFactory::get('seminar', 'frontend', array('slug' => $seminar->getSlug()), $seminar->getTitle())))
?>
<h1><?php echo $seminar->getTitle(); ?></h1>
<div class="table_seminar_wrap">
<table class="table_seminar" cellspacing="0" cellpadding="0" border="0" summary="info table">
<tr>
<th>Employee Id</th>
<td><?php echo $seminar->getId(); ?></td>
</tr>
<tr>
<th valign="top">情報公開日</th>
<td><?php echo $seminar->getPublishDate() .' '.$seminar->getPublishHour(); ?>時</td>
</tr>
<tr>
<th valign="top">セミナースキーム</th>
<td><?php echo $seminar->getStyle(); ?></td>
</tr>
<tr>
<th valign="top">日程</th>
<td><?php echo $seminar->getSeminarDate() .' '.$seminar->getStartTime() .' ~'.$seminar->getEndTime(); ?></td>
</tr>
<tr>
<th valign="top">前振りの文章</th>
<td><?php echo $seminar->getRawValue()->getSummary(); ?></td>
</tr>
<tr>
<th valign="top">タイトル</th>
<td><?php echo $seminar->getTitle(); ?></td>
</tr>
<tr>
<th valign="top">サブタイトル</th>
<td><?php echo $seminar->getSubTitle(); ?></td>
</tr>
<tr>
<th valign="top">開催地</th>
<td><?php echo $seminar->_getAddress(ESC_RAW); ?></td>
</tr>
<tr>
<th valign="top">会場</th>
<td>
<?php if($seminar->getLocationName()) : ?>
<?php echo $seminar->getLocationName(); ?><br>
<?php endif; ?>
<?php if($seminar->getRoomName()) : ?>
<?php echo $seminar->getRoomName(); ?>
<?php endif; ?>
</td>
</tr>
<?php if($seminar->getLocationName()) : ?>
<tr>
<th valign="top">会場URL</th>
<td><?php echo $seminar->getLocationUrl(); ?></td>
</tr>
<?php endif; ?>
<tr>
<th valign="top">内容</th>
<td><?php echo $seminar->getRawValue()->getDetail(); ?></td>
</tr>
<tr>
<th valign="top">キーチャート</th>
<td>
<?php if($seminar->getImagePath()): ?>
<a href="<?php echo $seminar->getImagePath(); ?>" target="_blank">
<img style="width:300px;" src="<?php echo $seminar->getImagePath(); ?>"/></a>
<?php endif; ?>
</td>
</tr>
<tr>
<th valign="top">対象</th>
<td>
<?php foreach($seminar->getTarget() as $target): ?>
<?php echo $target; ?>
<?php endforeach;?>
</td>
</tr>
<tr>
<th valign="top">定員・残席状況</th>
<td><?php echo $seminar->getCapacity(); ?>人</td>
</tr>
<tr>
<th valign="top">参加料</th>
<td><?php echo $seminar->getPrice(); ?></td>
</tr>
<tr>
<th valign="top">担当者</th>
<td><?php echo $seminar->getEmployee()->getName(); ?></td>
</tr>
<tr>
<th valign="top">講師</th>
<td>
<img class="instructorImage" alt="Instructor Image" src="<?php echo $seminar->getInstructor()->_getImagePath(); ?>" /><br>
<span><?php echo $seminar->getInstructor()->getName(); ?><span>
</td>
</tr>
<tr>
<th valign="top" style="width:170px">ご参加の皆様へのメッセージ</th>
<td><?php echo $seminar->getRawValue()->getMessage(); ?></td>
</tr>
<?php if($sf_user->isAuthenticated() && !$seminarXPerson): ?>
<tr>
<td style="text-align:center;" colspan="2">
<div class="blueBtnLink">
<span>応募する</span>
</div>
</td>
</tr>
<?php elseif(!$sf_user->isAuthenticated()): ?>
<tr>
<td style="text-align:center;" colspan="2">
<div class="blueBtnLink">
<span>応募する</span>
</div>
</td>
</tr>
<?php endif; ?>
</table>
<div id="ptxt_green">
<p>Please Write A Comments. . .</p>
</div>
<br />
<?php if($sf_user->isAuthenticated()): ?>
<form id="comment_form" action="<?php echo url_for('seminar/comment');?>" method="post">
<textarea id="txt_comment" name="txt_comment"></textarea>
<input type="submit" value="Write Comments" />
<br />
<br />
<div id="loading" style="text-align:center;">
<img alt="" src="/images/loading.gif" />
</div>
<div class="result">
<table id="tbl_comments">
<tr>
<td width="10%">Comments:</td>
<td>asasa</td>
</tr>
</table>
</div>
</form>
<?php endif; ?>
</div>
and my php file is this one
<?php
class commentAction extends sfAction{
public function execute($request){
echo "test"; exit();
//echo "qwqqwqqw"; exit();
//$post = $request->getParameter('seminar');
////print_r($post);exit();
//$comment = new SeminarComments();
//$comment->setComments($post['txt_comment']);
//$comment->save();
//$this->redirect('seminar');
}
}
?>
there.Why 500 internal server error? is this from the js? error?
neeeeeeeeeeed badly help

You have not provided enough info for anyone to give you a definitive answer, but here are some troubleshooting tips:
Check your server logs. To find where they are, see https://serverfault.com/questions/287079/cant-find-apache-error-logs and try to grep it out, here are a few to try (stolen directly from referenced ServerFault question)
grep ErrorLog /usr/local/etc/apache22/httpd.conf
grep ErrorLog /etc/apache2/apache2.conf
grep ErrorLog /etc/httpd/conf/httpd.conf
Once you find your server logs, find the log entry that corresponds to your 500 error. If you are having a hard time finding it, make another request with your client and then try to find the latest log entries.
Possible sources of error in your JavaScript include:
Calling the wrong URL
Calling the right URL but with the wrong parameters
Calling the right URL and parameters but with the wrong format (ie JSON vs XML)
Calling the right URL, parameters, and format but with wrong method (ie GET vs POST)
Calling the right URL/parameters/format/method but sending bogus data that the web server rejects (ie some servers are configured to automatically reject certain strings that look malicious)
By the way the server-side code you have posted does not tell the whole story. It is a simple class but rests on top of a complex framework, and you need to check the framework configuration to see if all is well. In particular, try calling the action directly (ie in your web browser, NOT through jQuery/JS). If it doesn't work, try calling a different action and see if it works. If you cannot get any action to work, it might be a framework config issue. I'm not familiar with symfony but if I were forced to become so I would start there.
If you can provide us the error log it would help greatly.

Try to call dev controller from your ajaxCall.
Normally you call index.php which is production controller and it doesn't provide any useful information about the error. Try to call front_dev.php instead which will return additional information about an error.
(the name of your dev controller is usually your app name suffixed with _dev.php so front_dev.php assumes your app name is front, which is default btw)

Related

PHP Notification Page - Table not displaying Results

I've created a notification script and I have a page called notificationCenter.php where the admin user can view ALL the notifications. It will display which users have read which notifications, when it was posted and who by. Everything works fine with it, the only issue is when I go onto the notificationCenter.php page to view all notifications, the table doesn't display the results. However I run an if statement to check if there are any results and I don't get any errors. Here's my code, I'm sure I've done something stupid but I can't see what it is, I'd really appreciate any help!.
//Get User ID
$id = $_SESSION['user_id'];
//Select * Notifications
$notQuery = $serviceConn->query("SELECT * FROM db759709251.notifications WHERE `not_viewedby` NOT LIKE '%$id%' ");
<h4>Nofication Center</h4>
<?php if($notQuery->rowCount()) { ?>
<table>
<thead>
<tr>
<th scope="col">Status</th>
<th scope="col">User</th>
<th scope="col">Notification</th>
<th scope="col">Date</th>
<th scope="col">Viewed By</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
<?php
while ($row = $notQuery->fetch()) {
$notid = $row['not_id'];
$notUser = $row['not_user'];
$notMsg = $row['not_msg'];
$notStatus = $row['not_status'];
$notDate = $row['not_date'];
$notViewedby = $row['not_viewedby'];
?>
<tr>
<td style="background-color: <?php echo $statusColour; ?>" data-label="Status"><?php echo $notStatus; ?></td>
<td data-label="User"><?php echo $notUser; ?></td>
<td data-label="Notification"><?php echo $notMsg; ?></td>
<td data-label="Date"><?php echo $notDate; ?></td>
<td data-label="Viewed By"><?php echo $notViewedby; ?></td>
<td data-label="">
<form action="" method="POST">
<input type="hidden" name="notificationID" value="<?php echo $notid; ?>" >
<input type="hidden" name="notificationBy" value="<?php echo $notViewedby; ?>">
<input type="submit" name="read" value="Dismiss!">
</form>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php } else { ?>
<p>You currently have no notifications, please check back later.</p>
<?php } ?>
Now obviously there is a lot of HTML in the middle for styling and layouts, but I didn't think it was important enough as it shouldn't have any effect on the output of the table. But as you can see the if statement SHOULD print that there are no notifications and to check back later, and it doesn't so in theory there should be records to display.

Passing Form Data to separate PHP Page

I have a table with multiple columns (index.php). One column is a checkbox. Whenever the checkbox is checked, it displays another row where you can select a quantity. You can then hit a button called "Add to Order" and it will take you to a confirmation page (index-order.php) where I want it to display each row along with all of the data in that specified row that has the checkbox checked. Currently, I am getting no errors in my console, but no data is being displayed at all.
What do I need to change to make this happen? Here is what I have so far.
Index.php code:
<form name="form1" method="POST" action="index-order.php">
<section id="addToOrder">
<button type="submit" class="order" id="order" name="order" value="AddToOrder">Add to Order</button>
</section>
<br>
<div id="my-div2" class="ui-widget">
<div class="ui-widget">
<table id="merchTable" cellspacing="5" class="sortable">
<thead>
<tr class="ui-widget-header">
<th class="sorttable_nosort"></th>
<th class="sorttable_nosort">Loc</th>
<th class="merchRow">Report Code</th>
<th class="merchRow">SKU</th>
<th class="merchRow">Special ID</th>
<th class="merchRow">Description</th>
<th class="merchRow">Quantity</th>
<th class="sorttable_nosort">Unit</th>
<th style="display: none;" class="num">Quantity #</th>
</tr>
</thead>
<tbody>
<?php foreach ($dbh->query($query) as $row) {?>
<tr>
<td class="ui-widget-content"><input type="checkbox" class="check" name="check"></td>
<td name="rows[0][0][loc]" class="loc ui-widget-content" id="loc-<?php echo intval ($row['Loc'])?>"><?php echo $row['Loc'];?></td>
<td name="rows[0][0][rp-code]" class="rp-code ui-widget-content" align="center" id="rp-code-<?php echo intval ($row['Rp-Code'])?>"><?php echo $row['Rp-Code'];?></td>
<td name="rows[0][0][sku]" class="sku ui-widget-content" id="sku-<?php echo intval ($row['SKU'])?>"><?php echo $row['SKU'];?></td>
<td name="rows[0][0][special-id]" class="special-id ui-widget-content" align="center" id="special-id-<?php echo intval ($row['Special-ID'])?>"><?php echo $row['Special-ID'];?></td>
<td name="rows[0][0][description]" class="description ui-widget-content" id="description-<?php echo intval ($row['Description'])?>"><?php echo $row['Description'];?></td>
<td name="rows[0][0][quantity]" class="quantity ui-widget-content" data-quantity="<?php echo $row['Quantity'] ?>" align="center" id="quantity-<?php echo intval ($row['Quantity'])?>"><?php echo $row['Quantity'];?></td>
<td name="rows[0][0][unit]" class="unit ui-widget-content" id="unit-<?php echo intval ($row['Unit'])?>"><?php echo $row['Unit'];?></td>
<td name="rows[0][0][quant]" style="display: none;" class="quantity_num ui-widget-content"><input type="textbox" style="width: 100px;" class="spinner" name="value" id="test"></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</form>
Index-order.php:
<?php if(isset($_POST['rows'])): ?>
<table cellspacing="20">
<tr align="center">
<th>Loc</th>
<th>Report Code</th>
<th>SKU</th>
<th>Special ID</th>
<th>Description</th>
<th>Quantity</th>
<th>Unit</th>
<th>Quantity #</th>
</tr>
<?php
foreach($_POST['rows'][0] as $row):
?>
<tr align="center">
<td><?php echo $row['loc']; ?></td>
<td><?php echo $row['rp-code']; ?></td>
<td><?php echo $row['sku']; ?></td>
<td><?php echo $row['special-id']; ?></td>
<td><?php echo $row['description']; ?></td>
<td><?php echo $row['quantity']; ?></td>
<td><?php echo $row['unit']; ?></td>
<td><?php echo $row['quant']; ?></td>
</tr>
<?php
endforeach;
?>
</table>
I am okay with the precedent answer, I never heard about this kind of method with PHP and it doesn't seems to be the right solution. Anyway, the following post would maybe help you : How to get value from td's via $_POST.
You cannot transfer datas through POST by using td ; but an alternative would be to use the "hidden" type of forms element :
<form action="script.php" method="post">
<td class=".."><input type="hidden" name="td1" value="...">value</td>
...
</form>
In PHP, you'll grab the data with the $_POST array and the td1 name :
<?php var_dump($_POST); ?>
Itwould in my opinion be the easier way to get what you want in a proper way ; the link I gave upper is also talking about DOMDocument, but it looks more complex to manage with.

Expand html table from two different php file

Need help...
I have 2 php file which are screen1.php and screen2.php
screen1.php consist of main data and screen2.php consist of history of main data.
Both main data and history store in 1 table.
How do I work if, i click main data in screen1.php it load history data from screen2.php into screen1.php
Thank you
If all the data is in the same table then you just need to include the data in your query? If you wanted to keep your query simple you could use Ajax
This looks like a job for Ajax.
You will need to include jquery library for this.
Page: main.php?user_id=4
<!----include Jquery library----->
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<!----include Jquery library----->
<title>Main Data</title>
</head>
<body>
<?php $sql="SELECT username, date, account_number, status
FROM table WHERE user_id=" . $_GET['user_id'] ;
//Do a prepared Statement to avoid SQL injection. Here I will just keep things simple
$user=$db->query($sql)->fetch();
?>
<table width="100%" border="1" id="main">
<tbody>
<th colspan="4">Main Data</th>
<tr>
<td align="center"><strong>Username</strong></td>
<td align="center"><strong>Date</strong></td>
<td align="center"><strong>Account Number</strong></td>
<td align="center"><strong>Status</strong></td>
</tr>
<tr>
<td><?php echo $user['username']//James Bond ?></td>
<td><?php echo $user['date']//18 Jan 2015 ?> </td>
<td><?php echo $user['account_number']//58241687929876 ?> </td>
<td><?php echo $user['status']//Active ?> </td>
</tr>
</tbody>
</table>
<button id="view_more">View more</button><!---give button a id--->
<div id="history">
<!------New data will be added here------>
</div>
<!------- THIS IS THE MAGIC PART ----------->
<script>
$(document).on('click','#view_more',function(){
//Event, button ID
$.ajax({
url:"view_history.php?user_id=<?php echo $_GET['user_id']; ?>"
//Link to history.php. Pass user_id to url
success:function(data){
$('#history').empty();
//empty history div if there is anything
$('#history').append(data).hide().fadeIn(500);
//And then append new data
}
});
});
</script>
<!------- THIS IS THE MAGIC PART ----------->
</body>
Page: history.php
<?php
$sql="SELECT type,date FROM table WHERE id=" . $_GET[user_id];
$history=$db->query($sql)->fetch();
?>
<table width="100%" border="1">
<tbody>
<th colspan="4">History of James Bond</th>
<tr>
<td align="center" width="50%"><strong>Type</strong></td>
<td align="center"><strong>Date</strong></td>
</tr>
<tr>
<td><?php echo $history['type'];//Fund ?></td>
<td><?php echo $history['date'];//18 Jan 2015 ?></td>
</tr>
<tr>
<td><?php echo $history['type'];//Refund ?></td>
<td><?php echo $history['date'];//21 Jan 2014 ?></td>
</tr>
<tr>
<td><?php echo $history['type'];//Refund ?></td>
<td><?php echo $history['date'];//22 Jan 2014 ?> </td>
</tr>
</tbody>
</table>
Please be careful take care of security measures.

Active/inactive users using checkbox in codeigniter

i need to update my database as soon as i check the checkbox with the value of 0(inactive) and 1(active). if i uncheck the checkbox the user would be unable to access the page means he/she is blocked from user panel. and if i check the box again the user can be enable to access the whole web means he/she would be unblocked.
i wonder if i can do this in codeigniter. i have searched for it but i cannot get them. Advance sorry it there is silly one.
Thankyou for any help.
This is my view file :
<div class="col-main">
<h1 class="page-title">All Users</h1>
<div class="admin_panel">
<ul class="form-fields">
<li class="full-row">
<table class="table demo">
<tr>
<td colspan="3">Add New</td>
</tr>
<tr>
<td colspan="3"><label>Quick Search : </label>
<input id="filter" type="text"/></td>
</tr>
</table>
</li>
</ul>
<table class="table demo table-bordered product_grid" data-filter="#filter">
<thead>
<tr>
<th>S.No</th>
<th>First Name</th>
<th>last Name</th>
<th>Password</th>
<th>Username</th>
<th>Password</th>
<th>Status</th>
<th colspan="2">Action</th>
</tr>
</thead>
<tbody> <tr>
<?php if(isset($pro_data) && $pro_data != false){ ;
foreach ($pro_data as $da) { ?>
<td><?php echo $da['reg_id']; ?></td>
<td><?php echo $da['reg_fname']; ?></td>
<td><?php echo $da['reg_lname']; ?></td>
<td><?php echo $da['reg_pass']; ?></td>
<td><?php echo $da['reg_email']; ?></td>
<td><?php echo $da['reg_pass']; ?></td>
<td><?php $data = array(
'name' => 'reg_fname',
'id' => 'reg_id',
'value' => 'accept',
'checked' => TRUE,
'style' => 'margin:10px',
);
echo form_checkbox($data);?></td>
<td class="edit"><a title="Edit" href="edit-user.php"><img title="Edit" alt="Edit" src="images/edit_icon.png"></a></td>
<td class="del"><a title="Remove" href="#"><img title="Remove" alt="Remove" src="images/delete_item_btn.png"></a></td>
</tr>
<?php }?>
<?php }?>
</tbody>
You can send a AJAX Request to the CodeIgniter Controller. The Controller updates the database. As soon as a User wants to visit the site, you check if he has the right to do.
If a user should be immediately get the new right (for example if he is on the forbidden site), you need Websockets.
I hope this helps. Your Question only gives little information about your Problem. Do you want immediately set rights (-> AJAX)? Why not a Form? Maybe I'm wrong and you ask for a completely different causing.

Ill formatted HTML from a PHP loop

I am looping through an array and building tables. The HTML is then sent to DOMPDF. However, DOMPDF will not create the PDF if the HTML is ill formatted. I assume that is what is happening in my case. Here is my loop:
<?php foreach($credits as $credit) : ?>
<?php if($credit['credit_type'] == "short") : ?>
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0px 0px 15px 0px;">
<tr>
<td><strong><?php echo $credit['category_title']; ?></strong></td>
</tr>
<tr>
<td><?php echo $credit['credit_heading']; ?></td>
</tr>
</table>
<?php endif; ?>
<?php if($credit['credit_type'] == "long") : ?>
<?php if($credit['category_title'] != $oldvalue) : ?>
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0px 0px 15px 0px;">
<tbody>
<?php endif; ?>
<tr>
<?php if($credit['category_title'] != $oldvalue) : ?>
<td width="25%"><strong><?php echo trim($credit['category_title']); ?></strong></td>
<td width="25%"><strong>Title</strong></td>
<td width="25%"><strong>Role</strong></td>
<td width="25%"><strong>Director</strong></td>
<?php endif; ?>
</tr>
<tr>
<td width="25%"><?php echo $credit['credit_heading'];?></td>
<td width="25%"><?php echo $credit['credit_title']; ?></td>
<td width="25%"><?php echo $credit['credit_role']; ?></td>
<td width="25%"><?php echo $credit['credit_director']; ?></td>
</tr>
<?php if($credit['category_title'] != $oldvalue) : ?>
</tbody>
</table>
<?php endif; ?>
<?php $oldvalue = $credit['category_title']; ?>
<?php endif; ?>
<?php endforeach; ?>
I cannot for the life of me work out which tag I am not closing. If anyone could give some insight, that would be fab!
Specifically, the loop is creating rows that show some headings, and then spit out futher rows whenever the category title changes.
This may be a simple solution but perhaps not the best:
I recommend you to use PHP's Tidy class (eventually you'll have to install it first...)
Here is the link for the Tidy class Manual.
At the first line:
ob_start();
This command buffers everything what is outputed by your follwing script.
The code below should be added at the end of your file, or there where you want to show the output.
It first gets the buffer with ob_get_contents() and than it cleans the code up.
Note that you'll eventually have to change the configuration parameters for your needs, there are really very much.
$raw_output = ob_get_clean();
$config = array('indent' => true, 'output-xhtml' => true, 'wrap' => 0);
$tidy = new Tidy;
$tidy->parseString($raw_output, $config, 'utf8');
$tidy->cleanRepair();
echo $tidy;
This Example Code was modified by the original version of the example on php.net.
Hope that helps you.
It's a bit difficult to parse without known more about your data. For example, why is a table for "short" credit open and closed with the record, but the table for "long" credit is conditional on the previous record? Is it because you have a flat data structure so related data shows up as a series of consecutive rows? If that's the case things would be easier if the data were a bit more normalized. I.e. you could iterate through each credit record then through the details separately. Any possibility of fixing your data structure?
Analyzing the code you have, your problem appears to be in the logic for the second section of the code. You are setting the value of the variable $oldvalue at the end of the loop. This is after the logic that closes the table. So if you parse two records that have the same category title the second record will output it's table rows completely outside a table (never mind that it will also have a completely empty row). Additionally, if you have a short credit type following a long the table will never be closed.
That being said, working with what you have I'm guessing you may need something like the following:
// build a dummy "previous" record for the first iteration so the conditionals don't break.
<?php $previous_credit = array('credit_type'=>null,'category'=>null); ?>
<?php foreach($credits as $credit) : ?>
<?php if($credit['credit_type'] == "short" || ($previous_credit['credit_type'] == "long" && $previous_credit['category'] != $credit['category'])) : ?>
</tbody>
</table>
<?php endif; ?>
<?php if($credit['credit_type'] == "short") : ?>
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0px 0px 15px 0px;">
<tr>
<td><strong><?php echo $credit['category_title']; ?></strong></td>
</tr>
<tr>
<td><?php echo $credit['credit_heading']; ?></td>
</tr>
</table>
<?php endif; ?>
<?php if($credit['credit_type'] == "long") : ?>
<?php if($credit['category_title'] != $previous_credit['category_title']) : ?>
<table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin:0px 0px 15px 0px;">
<tbody>
<tr>
<td width="25%"><strong><?php echo trim($credit['category_title']); ?></strong></td>
<td width="25%"><strong>Title</strong></td>
<td width="25%"><strong>Role</strong></td>
<td width="25%"><strong>Director</strong></td>
</tr>
<?php endif; ?>
<tr>
<td width="25%"><?php echo $credit['credit_heading'];?></td>
<td width="25%"><?php echo $credit['credit_title']; ?></td>
<td width="25%"><?php echo $credit['credit_role']; ?></td>
<td width="25%"><?php echo $credit['credit_director']; ?></td>
</tr>
<?php endif; ?>
<?php $previous_credit = $credit; ?>
<?php endforeach; ?>
<!-- one last table close for the last record -->
</tbody></table>
(That's some ugly code and I don't have time to keep revising it, so ... community wiki in case anyone else wants to clean it up.)

Categories