We'll I've got a query based on mysql_fetch_object to show the results of the previous
search and print them out in tables. Then I got the the $grid idea for printing an
array in a horizontally columned table from the book php cookbook from o'reilly (quite
useful) then I print it all insed the grid, but when it is supposed to send the
selected objects with a checkbox to the next page. It doesn't while everything works
just fine without the grid. #sigh# I've tried to see what's the grid doing to my
checkboxes that i the end they don't send anything at all bu i cant see what. Does
anyone?
...
while ($inb = mysql_fetch_object($resultInfs))
{
//trying to put it right --- values ---
if (!empty($inb->pix))
$ipix="<img src='$inb->pix' width='200'><br>";
} else {
$ipix="<img src='notaval.gif' width='200'><br>";
}
if (!empty($inb->infType)) {
$ity="$inb->infType,<br>";
}
if (!empty($inb->infName)) {
$inm="$inb->infName<br>";
}
if (!empty($inb->infRef)) {
$irf="$inb->infRef<br>";
}
if (!empty($inb->infMeas)) {
$ims="$inb->infMeas<br>";
}
if (!empty($inb->infSerial)) {
$isr="<strong>SERIAL N�: $inb->infSerial</strong><br>";
}
if (!empty($inb->infDescription)) {
$ids="DETAILS: $inb->infDescription,<br>";
}
if (!empty($inb->infArtw)) {
$irt="$inb->infArtw,<br>";
}
if (!empty($inb->infCover)) {
$irc="$inb->infCover,<br>";
}
// T.T $value deosn't go as $_POST for orderdata.php!!!
$value = $inb->infID;
//for function, hope as objects
$infs[ ] = $ipix.' '.$ity.' '.$inm.' '.$irf.' '.$ims.' '.$isr.' '.$ids.' '.$irt.'
'.$irc.' '.$value;
}
///changes to function from phpckbk
function grid_horizontal($array, $size) {
// compute <td> width %ages
$table_width = 100;
$width = intval($table_width / $size);
$grid = "<table width=\"$table_width%\" border=\"1\" bordercolor=\"#0000FF\"><form
action=\"orderdata.php\" method=\"POST\" name=\"details\">$tr";
// define how our <tr> and <td> tags appear
// sprintf() requires us to use %% to get literal %
$tr = '<tr align="center">';
$td = "<td width=\"$width%%\">%s<input name=\"$value\" type=\"checkbox\"
value=\"$value\">Add to Cart!</td>";
// open table
// loop through entries and display in rows of size $sized
// $i keeps track of when we need a new table tow
$i = 0;
foreach ($array as $e) {
$grid .= sprintf($td, $e);
$i++;
// end of a row
// close it up and open a new one
if (!($i % $size)) {
$grid .= "</tr>$tr";
}
}
// pad out remaining cells with blanks
while ($i % $size) {
$grid .= sprintf($td, ' ');
$i++;
}
// add </tr>, if necessary
$end_tr_len = strlen($tr) * -1;
if (substr($grid, $end_tr_len) != $tr) {
$grid .= '</tr>';
} else {
$grid = substr($grid, 0, $end_tr_len);
}
// close table
$grid .= '<input name="submit" type="submit" value="ORDER"></form></table>';
return $grid;
}
//final results printing
$grid = grid_horizontal($infs, 3);
print $grid;
If the grid can not work with a sending to another php (that is with my checkboxes,
how could i print them ordered then?
---------------------------------
Cr�ez gratuitement votre Yahoo! Mail avec 100 Mo de stockage !
Cr�ez votre Yahoo! Mail
Le nouveau Yahoo! Messenger est arriv� ! D�couvrez toutes les nouveaut�s pour
dialoguer instantan�ment avec vos amis.T�l�chargez GRATUITEMENT ici !