php - Inserting values from mysql_fetch_assoc into form input -
i have som problem writing table. connect table wanted , information output correctly. input correctedby, , checkboxes saving want. dont know how write mysql_fetch_assoc table have kode;
<?php session_start(); $_session['mypassword']="myusername"; echo "logged in as:<br>" .$_session['myusername']; include "header.inc.php"; include "funksjoner.inc.php"; //in file connetion server $connection= kobletil(); //trenger ikke oppgi databasenavn //steg 2: sql-query $sql = "select * oppgave modulid=1 , resultat null order rand() limit 1"; $result = mysql_query($sql, $connection); echo "<hr>"; while ($nextrow= mysql_fetch_assoc($result)){ echo "answer: " . $nextrow['answer']; echo "<br>modulid: " . $nextrow['modulid']; echo "<br>student: " . $nextrow['studentid']; echo "<br>"; } echo '<form name="input" action="tilretting.php" method="get">'; echo'<input type="text" name="correctedby" value="'.$_session['myusername'].'">'; echo 'not approved<input type="checkbox" name="resultat" value="0">'; echo 'approved<input type="checkbox" name="resultat" value="1">'; echo '<input type="text" name="studentid" value="dont know how write correct here">'; echo '<input class="levermodulknapp" type="submit" name="lever1" value="lever modul 1">'; echo "</form>"; echo "<hr>"; ?>
how can form value mysql_fetch_assoc form? mysql_fetch_assoc right thing use? gratefull tip!
$result = mysql_query($sql, $connection); echo "<hr>"; while ($nextrow= mysql_fetch_assoc($result)){ echo "answer: " . $nextrow['answer']; echo "<br>modulid: " . $nextrow['modulid']; echo "<br>student: " . $nextrow['studentid']; echo "<br>"; echo '<form name="input" action="tilretting.php" method="get">'; echo'<input type="text" name="correctedby" value="'.$_session['myusername'].'">'; echo 'not approved<input type="checkbox" name="resultat" value="0">'; echo 'approved<input type="checkbox" name="resultat" value="1">'; echo '<input type="text" name="studentid" value="'.$nextrow['columnname'].'">'; echo '<input class="levermodulknapp" type="submit" name="lever1" value="lever modul 1">'; echo "</form>"; echo "<hr>"; }
or
$data = null; $result = mysql_query($sql, $connection); echo "<hr>"; while ($nextrow= mysql_fetch_assoc($result)){ echo "answer: " . $nextrow['answer']; echo "<br>modulid: " . $nextrow['modulid']; echo "<br>student: " . $nextrow['studentid']; echo "<br>"; $data = $nextrow['colunmname']; } echo '<form name="input" action="tilretting.php" method="get">'; echo'<input type="text" name="correctedby" value="'.$_session['myusername'].'">'; echo 'not approved<input type="checkbox" name="resultat" value="0">'; echo 'approved<input type="checkbox" name="resultat" value="1">'; echo '<input type="text" name="studentid" value="'.$data.'">'; echo '<input class="levermodulknapp" type="submit" name="lever1" value="lever modul 1">'; echo "</form>"; echo "<hr>"; } ?>
Comments
Post a Comment