Forum Moderators: coopster
<form action="" method="post" name="FeedbackForm">
<p>Please choose a number to represent the impact each of these factors had on your choice today. 1 means not important, while 7 means extremely important.</p>
<script language="php">
$_SESSION['ReasonsMultipleChoice'] = getReasonsMultipleChoice(); #The factors or choice reasons are obtained from a MySQL table, ORDER BY RAND().
$_SESSION['CountReasons'] = count($_SESSION['ReasonsMultipleChoice']);
for ($i=1;$i<=$_SESSION['CountReasons'];$i++)
{
$ReasonID = "Reason".$_SESSION['ReasonsMultipleChoice'][$i]['ReasonID'].'[]';
print "<select name='$ReasonID' >";
for ($k=1;$k<=7;$k++)
{
print "<option value='$k'>$k</option>";
}
print "</select> " . $_SESSION['ReasonsMultipleChoice'][$i]['ReasonDescription']. " <br />"; # This is just the name of each factor.
}
<input type='submit' name='FeedbackButton' value='Submit your feedback.'>
</form> foreach (array_keys($_POST) as $key){
$$key = $_POST[$key];
print "$key is ${$key}<br />";
} foreach (array_keys($_POST) as $key) {
$$key = $_POST[$key];
: if (isset($_POST['FeedbackButton'])) {
$i = 1;
foreach ($_POST as $key => $value) {
if (substr($key, 0, 6) == "Reason") {
$_SESSION['Reason']['ID'][$i] = substr($key, 6);
$_SESSION['Reason']['Strength'][$i] = $value;
$i+=1;
}