isharis Posted August 17, 2007 Share Posted August 17, 2007 <?php // Last Modified 17th August include('templates/header.php'); // Header template include('config/config.php'); // Includes configuration files include('lib/functions.php'); // Load all functions from Library $select_questions = mysql_query("SELECT * FROM questions") or die(mysql_error()); echo "<form method=\"post\">"; while($row = mysql_fetch_array($select_questions)){ $questions = $row['question']; $qID = $row['id']; echo $questions."<br/>For: <input type=\"radio\" value=\"For\" name=\"".$qID."\"><br/>Against: <input type=\"radio\" value=\"Against\" name=\"".$qID."\"><br/><br/>"; $posted_answer = $_POST[$qID]; $submit_useranswer = $_POST['submit_useranswers']; } echo "<input type=\"submit\" name=\"submit_useranswers\">"; echo "</form>"; if(isset($submit_useranswer)){ $user_answer = array($posted_answer); print_r($user_answer); } include('templates/footer.php'); // Footer Template ?> I have assigned the question_id to the radio boxes names so I can post them in an array and also differentiate. I'm stuck at $posted_answer = $_POST[$qID];, I want the radio values for each qID to be stored in that variable($posted_answer) and somehow I can convert those values into an array. Any ideas? If I'm not clear, please let me know. If there's a better way, do let me know. Link to comment https://forums.phpfreaks.com/topic/65522-solved-stuck-with-while/ Share on other sites More sharing options...
Fadion Posted August 17, 2007 Share Posted August 17, 2007 Im not getting it, u need to pass to $posted_answer the selected radio value(s) or create an array of ids? Link to comment https://forums.phpfreaks.com/topic/65522-solved-stuck-with-while/#findComment-327175 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.