Jump to content

[SOLVED] how to make each name different in an echo table?


shadiadiph

Recommended Posts

Probably a simple solution to this but i can't think of one right now can anyone help i have a tale that achos the data i want to make table td name="news[]" produce a different value on each row i.e name="news0"  next row name="news1"

The value row dispalays a different valiable as it has one already.

 

anyway here is my code any pointers will be appreciated  I want to keep this simple.

 

 

<table class="users">
<tr><td><strong>CURRENTLY DISPLAYED NEWS ARTICLES</strong></td></tr>
<? 
$sql = "SELECT * FROM tblnewsdetails order by intnewsID desc limit 20"; 
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)) {
$tradeaid = $row["intnewsID"];
$accountid = $row["intAccountID"];
$stitle = $row["newsshTit"];
$mtitle = $row["newsTit"];
$nmain = $row["newsMn"];
$updated = $row["dtAddedOn"];
?>

<?

echo '<tr><td><input type="checkbox" name="news[]"  value="'. $tradeaid. '"  /></td><td width="90% align="left">'. $mtitle. '</td></tr>';

}
?>
</form>
</table>

 

I assume you mean this;

 

<table class="users">
<tr><td><strong>CURRENTLY DISPLAYED NEWS ARTICLES</strong></td></tr>
<?php
$sql = "SELECT * FROM tblnewsdetails order by intnewsID desc limit 20";
$result = mysql_query($sql);
$i=0;
while ($row = mysql_fetch_assoc($result)) {
$tradeaid = $row["intnewsID"];
$accountid = $row["intAccountID"];
$stitle = $row["newsshTit"];
$mtitle = $row["newsTit"];
$nmain = $row["newsMn"];
$updated = $row["dtAddedOn"];


echo '<tr><td><input type="checkbox" name="news'.$i.'"  value="'. $tradeaid. '"  /></td><td width="90% align="left">'. $mtitle. '</td></tr>';
$i++;
}
</form>
</table>

?>

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.