我对php相当陌生。每次循环遍历此数组时,我都会尝试更新分数。我的代码仅在用户选择列表框的第一个值时才有效,如果未选择,它会给出零。请帮忙。这是 A.php
{
$SkillsArray = array();
$Score=0;
$SkillsArray = $_POST['DutiesDesc'];
//foreach($SkillsArray as $key =>$value )
{
$Sentence = $SkillsArray[0]." ".$SkillsArray[1]." ".$SkillsArray[2]." ".$SkillsArray[3]." ".$SkillsArray[4]." ".$SkillsArray[5]." ".$SkillsArray[6]." ".$SkillsArray[7 ]." ".$SkillsArray[8]." ".$SkillsArray[9]." ".$SkillsArray[10];
}
//Get the applicants score
for($i=0;$i<11;$i++)
{
if ($SkillsArray[$i] == $Text[$i])
{
$Score = $Score+$Val[$i];
}
}
} //**** The following is the HTML part of the code(form)
<form action = "A.php" method ="POST" enctype="multipart/form-data">
<label for="Position">Position:</label><input type="type" name="Position" size="35" /><br />
</p>
<p>
<!-- <label for="DutiesDesc">Duties Description: </label><textarea name="DutiesDesc" cols="30" rows="5" /></textarea>--> <br />
Job Description
<select name="DutiesDesc[]" size=5 multiple="multiple">
<option value="<?php echo $Arow['TextF1']?>"><?php echo $Arow['TextF1']?></option>
<option value="<?php echo $Arow['TextF2']?>"><?php echo $Arow['TextF2']?></option>
<option value="<?php echo $Arow['TextF3']?>"><?php echo $Arow['TextF3']?></option>
<option value="<?php echo $Arow['TextF4']?>"><?php echo $Arow['TextF4']?></option>
<option value="<?php echo $Arow['TextF5']?>"><?php echo $Arow['TextF5']?></option>
<option value="<?php echo $Arow['TextF6']?>"><?php echo $Arow['TextF6']?></option>
<option value="<?php echo $Arow['TextF7']?>"><?php echo $Arow['TextF7']?></option>
<option value="<?php echo $Arow['TextF8']?>"><?php echo $Arow['TextF8']?></option>
<option value="<?php echo $Arow['TextF9']?>"><?php echo $Arow['TextF9']?></option>
<option value="<?php echo $Arow['TextF10']?>"><?php echo $Arow['TextF10']?></option>
<option value="<?php echo $Arow['TextF11']?>"><?php echo $Arow['TextF11']?></option>
</select><br />