sql in FORM action

#1

Building an order form that worked out well in ASP but now I need to learn PHP and also migrate it to PHP/Apache.
How do I define “name” in row 11 inside the FORM?
The FORM returns just [‘name’] when processing next step.
Figure there should be some kind of array or else?

1 $sql = "SELECT `id`, `name`, `description`, `price` FROM `penslar01` WHERE 1";
2 $result = $conn->query($sql);
3
4 if ($result->num_rows > 0) {
5 // output data of each row
6	
7  while($row = $result->fetch_assoc()) {
8  echo "<FORM NAME=order>";
9  echo $row["id"]. " &nbsp; " . $row["name"]. "  &nbsp; " . $row["description"]."  &nbsp; Pris SEK " . $row["price"].":-<br>";
10 echo " Antal:<input type=text size=2 maxlength=3 name=QUANTITY  onChange='this.value=CKquantity(this.value)' value=1>";
11 echo "<input type=hidden name=NAME value=[‘name’]>";
12 echo "<input type=button value='  Lägg i kundvagn  ' onClick='AddToCart(this.form)'></FORM><hr>";
13 }
14 } else {
15 echo "0 results";
16 }
17 $conn->close();
#2

What should be there? The value from the database?

1 Like