0

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>';
}
?>
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by slap01
0

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 . '" >';
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.