php - how to get data from post method -
my problem have 2 pages on first page giving mcq's name have given radio button same in mysql table index id how can recieve posted value on other page code folllows:
$result = mysql_query("select * mcq order rand()",$connection); if(!$result) {die("could not query".mysql_error());} while($row = mysql_fetch_array($result)) { echo "<form action=\"grade.php\" method=\"post\">"; echo "question number : {$row['id']}<br>{$row['ques']}<br>"; echo "<input type=\"radio\" name=\"{$row['id']}\" value={$row['op-a']}>{$row['op-a']}<br>"; echo "<input type=\"radio\" name=\"{$row['id']}\" value={$row['op-b']}>{$row['op-b']}<br>"; echo "<input type=\"radio\" name=\"{$row['id']}\" value={$row['op-c']}>{$row['op-c']}<br>"; echo "<input type=\"radio\" name=\"{$row['id']}\" value={$row['op-d']}>{$row['op-d']}<br>"; } echo "<input type=\"submit\" value=\"next\"><br>"; echo "</form>";
and on second page recieving not working ..
$result = mysql_query("select * mcq ",$connection); if(!$result) {die("could not query".mysql_error());} while($row = mysql_fetch_array($result)) { echo $_post['{$row["id"]}']; }
evaluate $row['id'] separately , use intuition match them because once html page rendered, string '{$row["id"]}' replace value.
so try:
echo $_post['{'.$row["id"].'}']
then tune liking.
Comments
Post a Comment