ho un campo alimentato automaticamente dal codice rand() di php.
Volevo tramite id di poter stampare un codice a barre, ma il sistema mi restituisce sempre il campo vuoto.
dove sbaglio?
Codice PHP:
<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>