php - How do I put data with button into a table through foreign key? -


i'm working on web application school , goal create several classes , put students in it, , thinking, first think insert class , next thing select classes , put button next it, lead selecting or inserting students specific class. , have problem, because don't know, how connect buttons classes, guess has id , attach button, have no idea, how should that.

two tables, students , classes. students has constraint class id.

$sql = "select id, class_name, year class"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) {  while($row = mysqli_fetch_assoc($result)) {     echo "id: " . $row["id"]. " - class name: " . $row["class_name"]. " - year: " . $row["year"]." <button><a href=index.php?content=students>enter class</a></button>"."<br>";    } } 

you can add more variables href of button. classid=$row["id"]. combine variables &sign. in index.php can evaluate value of classid.


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -