Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $sql = "SELECT Q_body, Q_ID FROM s_evaluation_questions WHERE Ev_ID='1'";
- $result = $conn->query($sql);
- ?>
- <?php
- if ($result->num_rows > 0)
- {
- ?>
- <form action="AnswerS.php" method="POST">
- <table align="right" id="keywords" cellspacing="0" cellpadding="0">
- <thead>
- <tr>
- <th colspan="4"> </th>
- <th>Question</th>
- </tr>
- </thead>
- <tbody>
- <?php
- while($row = $result->fetch_assoc())
- { $answer="s".$row["Q_ID"];
- ?>
- <tr>
- <td>
- <input type="hidden" name="Q_ID" value="<?php echo $row["Q_ID"]; ?>" >
- <input type="radio" name=<?php echo $answer?> value="Bad" >Bad
- <input type="radio" name=<?php echo $answer?> value="Good"> Good
- <input type="radio" name=<?php echo $answer?> value="VeryGood"> Very Good
- <input type="radio" name=<?php echo $answer?> value="Excellent"> Excellent</td>
- <td align="right"> <?php echo $row["Q_body"]?></td>
- </tr>
- <?php } ?>
- </tbody>
- </table></br></br></br></br></br></br></br>
- <input type="submit" value="Send" />
- </form>
- <?php
- ?></div>
- <?php
- } else
- {echo "not allowed";}
- and on the AnswerS.php page I suppose to store the answers on db as the following:
- $UID='1';
- $answer=$_POST['answer'];
- $Q_ID= $_POST['Q_ID'];
- $sql = "INSERT INTO s_evaluation_answers(Q_ID, A_body, UID) VALUES($Q_ID, $answer, $UID) ";
- $result = $conn->query($sql);
- if ($result === TRUE) {
- echo "done" ;
- }
- else {
- echo "Error: " . $sql . "<br>" . $conn->error;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement