Jump to content

Recommended Posts

Hello, I have a table that I read in from a postgresql database but I need to add a column that has checkboxes in the final row.

 

It is for a shop so then when the item is selected via checkbox I can then press an add to cart button and send this using an array to the cart.php page.

 

Firstly I need to be able to add checkboxes to the end of each row before I can even do that and I am struggling at how to get a checkbox at the end of each row of my table.

 

 

<form action="index.php" method="post">
<table>
<tr>
<th>ref</th>
<th>title</th>
<th>platform</th>
<th>description</th>
<th>price</th>
<th>select</th>
</tr>


<?php
$resource = pg_query ($connect, "select refnumber,title,platform,description,price from CSGames");


while ($row = pg_fetch_array ($resource)) {
$result[] = $row;
}

foreach($result as $key => $value)
{
echo "<tr>";
for ($j = 0; $j < pg_num_fields ($resource); $j++) {
echo "<td>".$a[$j]."</td>";
}
echo "</tr>";


}


?>
</table>

 

Could any help with this and explain so I can understand what is occurring in the future please?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.