I am having a problem refering to the result of a drop down menu from a form. I have included the relevant code below
the first section of code is the drop down menu which is populated from a text file.
<code>
<select name="Forname_Drop">
<?php
for($rowCounter=0; $rowCounter < count($rows); $rowCounter++)
{
$cells = explode($second_break, $rows[$rowCounter]);
echo $rows[rowCounter];
?>
<option value="<?php echo $cells[0]; ?>"><?php echo $cells[0];?></option>
<?php } ?>
</select></code>
Then I attempt to refer to the result of the drop down choice in the resulting page using this code; which attempts to extract the details of a person from a text file if there name equals the drop down result
<code>
<?php
for($rowCounter=0; $rowCounter < count($rows); $rowCounter++)
{
$cells = explode($second_break, $rows[$rowCounter]);
echo $rows[rowCounter];
if ($Forname_Drop = $cells[0]) {
?>
<tr><td>
Name: <?php echo $Forname_Drop; ?><br>
Project: <?php echo $cells[1]; ?> <br>
Cost Center: <?php echo $cells[2]; ?> <br>
Region: <?php echo $cells[3]; ?> <br>
</td>
</tr>
<?php }} ?>
</code>
My result is that the details for all people within the text file are displayed, whereas I only want the person whose name is selected in the drop down
the first section of code is the drop down menu which is populated from a text file.
<code>
<select name="Forname_Drop">
<?php
for($rowCounter=0; $rowCounter < count($rows); $rowCounter++)
{
$cells = explode($second_break, $rows[$rowCounter]);
echo $rows[rowCounter];
?>
<option value="<?php echo $cells[0]; ?>"><?php echo $cells[0];?></option>
<?php } ?>
</select></code>
Then I attempt to refer to the result of the drop down choice in the resulting page using this code; which attempts to extract the details of a person from a text file if there name equals the drop down result
<code>
<?php
for($rowCounter=0; $rowCounter < count($rows); $rowCounter++)
{
$cells = explode($second_break, $rows[$rowCounter]);
echo $rows[rowCounter];
if ($Forname_Drop = $cells[0]) {
?>
<tr><td>
Name: <?php echo $Forname_Drop; ?><br>
Project: <?php echo $cells[1]; ?> <br>
Cost Center: <?php echo $cells[2]; ?> <br>
Region: <?php echo $cells[3]; ?> <br>
</td>
</tr>
<?php }} ?>
</code>
My result is that the details for all people within the text file are displayed, whereas I only want the person whose name is selected in the drop down