I've been coding for about 3hours i can't seem to see whats wrong, all help is much appreciated! :)

<html>
<body>
<form method = "get" action = "SLAP2.php">

<center>
RANDOM IMAGES<br>
<table> 
<?php
	$images = array('2010 BMW M6.jpg','2011 BMW 750 Li.jpg','2009 BMW M5.jpg','2010 BMW 650 i.jpg','2010 BMW X6 ActiveHybrid.jpg','2010 BMW 550 I 

G.jpg','2011 BMW X6 xDrive50i.jpg','2011 BMW X6 xDrive50i.jpg','2011 BMW X5 xDrive50i.jpg');
	shuffle($images);

for($x=0; $x<3; $x++) 
	{
			echo '<tr>';
			for($y=$x*3; $y<(($x+1)*3) ; $y++)
			{
				echo '<td align="center"><img src="';
  				echo $images[$y];
				echo '" width="150" height="150">';
				$s = $images[$y];
				$snew = substr($s,0,-4);
				echo '<br>';
				echo '<input type = "checkbox" name = "num[]" value = <?php echo $snew;?> >';
				echo 'Add to cart <br>';
				echo '</td>';
  				
			}
			echo'</tr>';
			
	}
echo '<center><input type = "submit" name = "submit" value = "ORDER"></center>';
										
?>
</center>

</body>
</table>
</html>

<?php
echo 'Order list: ';
$prod = $_GET['num'];

foreach($prod as $car)
{
	echo $car.'<br>';
}
?>

Recommended Answers

All 2 Replies

Not sure what you want to do, and where your problem lies. The only thing I can see from this code, is that line 25 is wrong. The <?php code tag in the echo will not work. You can do this:

echo '<input type = "checkbox" name = "num[]" value = "' . $snew . '" >';

sory for the late reply., thanks pritaeas!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.