Good evening to all, I would like to print a bar code for each type of pasta. I adapted this code to mine, but it does not read the data that is within the code field. (Which is created by the php rand () code) I would choose the id through the bar code to be printed.
<html>
<head>
<?php
$con=mysqli_connect("localhost","xxx","xxx","xxx");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$id = $_GET['id'];
$query= "select * from pasta where id='$id'";
$result = mysqli_query($con,$query);
while ($row = mysqli_fetch_assoc($result)){
$rand=$row['codice'];
}
?>
<br>
<div style="width:25px: height:500px; border:2px, solid #000; align="center"">
<div align="center">
<img src="http://bcgen.com/demo/linear-dbgs.aspx?=D<?php echo $rand ?>">
<br>
<form action ="stampa.php" method="post">
<input type="button" value="stampa"
onClick="window.print()"/>
</form>
</body>
</html>