Thanks for your help,
But i knew that you will get me wrong because I didnt know how to explain my problem properly.
I have an online survey that contains some questions, in each page there is one question with different answers in radio buttons. The user can choose only one answer from each question. Each answer will lead to different page. when he or she clicks to the next button which is in a every page. The next button will store the answer in a text file.
The code that I have given is for making a change to the answers that the user has already provided. Instead of going back to the previous pages i decided to have one page that contains all the questions and answers. I put the answers into a menu list so that a user can choose from it. In case that a user wants to change only one answer that he or she has given.
I want the menu list to show the same answer that the user has given previously (same choices of the radio button) next to each question then he or she can change it with a different one.
for example: if the user answers to the question Gender? and he chose radiobutton male. so in the edit page, next to the question Gender? should show the first choice of the menu list which is male not anything else... 😕
here is the code of all script so maybe you can get what I want to explain to you.
<?php
$file = fopen("testing.doc","r");
while(! feof($file))
{
$i++;
$Data[$i] = fgets($file). "<br />";
}
fclose($file);
print_r ($Data);
$SELECTED = "selected=\"selected\"";
switch ($LMAchievement)
{
case "Weight Loss": $selected1 = $SELECTED; break;
case "Toning": $selected2 = $SELECTED; break;
case "Body Shaping": $selected3 = $SELECTED; break;
case "Muscle Gain": $selected4 = $SELECTED; break;
case "Weight Gain": $selected5 = $SELECTED; break;
case "Rehab From Existing Injury": $selected6 =$SELECTED; break;
}
print "<form name=\"form1\" method=\"post\" action=\"\">";
print "<table width=\"614\" border=\"1\">";
print "<tr>";
print "<td width=\"363\">What do you want to achieve?</td>";
print "<td width=\"235\"><select name=\"LMAchievement\" id=\"LMAchievement\">";
print "<option value=\"Weight Loss\" $selected1>Weight Loss</option>";
print "<option value=\"Toning\" $selected2>Toning</option>";
print "<option value=\"Body Shaping\" $selected3>Body Shaping </option>";
print "<option value=\"Muscle Gain\" $selected4>Muscle Gain</option>";
print "<option value=\"Weight Gain\" $selected5>Weight Gain </option>";
print "<option value=\"Rehab From Existing Injury\" $selected6>Rehab From Existing Injury </option>";
print "</select></td>";
print "</tr>";
print "<tr>";
print "<td>How much muscle do you want to gain? </td>";
print "<td>";
print "</td>";
print "</tr>";
print "<tr>";
print "<td>When did you want to achieve this by? <BR></td>";
print "<td><select name=\"LMWhenAchieve\" id=\"LMWhenAchieve\">";
print "<option value=\"1-3 months \">1-3 months </option>";
print "<option value=\"3-6 months\">3-6 months</option>";
print "<option value=\"6-9 months\">6-9 months</option>";
print "<option value=\"9-12 months\">9-12 months</option>";
print "</select></td>";
print "</tr>";
print "<tr>";
print "<td>When did you want to exercise? <BR></td>";
print "<td><select name=\"LMWhenExercise\" id=\"LMWhenExercise\">";
print "<option value=\"Early Morning \">Early Morning </option>";
print "<option value=\"Mid Morning\">Mid Morning</option>";
print "<option value=\"Lunch Time\">Lunch Time</option>";
print "<option value=\"Afternoon\">Afternoon</option>";
print "<option value=\"Afterwork\">Afterwork</option>";
print "<option value=\"Late Night\">Late Night</option>";
print "<option value=\"Midnight To Dawn\">Midnight To Dawn</option>";
print "</select></td>";
print "</tr>";
print "<tr>";
print "<td>How many times a week do you plan to come to the gym? <BR></td>";
print "<td><select name=\"LMComeToGym\" id=\"LMComeToGym\">";
print "<option value=\"1\">1</option>";
print "<option value=\"2\">2</option>";
print "<option value=\"3\">3</option>";
print "<option value=\"4\">4</option>";
print "<option value=\"5\">5</option>";
print "<option value=\"6\">6</option>";
print "<option value=\"Everyday\">Everyday</option>";
print "</select></td>";
print "</tr>";
print "<tr>";
print "<td colspan=\"2\"><div align=\"center\">";
print "<input name=\"BtnCofirm\" type=\"submit\" id=\"BtnCofirm\" value=\"Confirm\">";
print "</div></td>";
print "</tr>";
print "</table>";
print "</form>";
?>