Hi All
I am using a foreach loop to display a list of input fields, as below:
[code=php]
<?php
$dateArray = array(“01″,”02″,”03″,”04″,”05″,”06″,”07″,”08″,”09″,”10″,”11″,”12″,”13″,”14″,”15″,”16″,”17″,”18″,”19″,”20″,”21″,”22″,”23″,”24″,”25″,”26″,”27″,”28″,”29″,”30″,”31”);
foreach ($dateArray as $displayDate) {
$textStartMiles = “startMiles” . $displayDate;
echo “<input type=’text’ class=’inputWidths’ id='” . $textStartMiles . “‘ name='” . $textStartMiles . “‘ maxlength=’40’ value=’$startMiles” . $displayDate . “‘ />”;
}
?>
The loop works well in that the list produces 31 input fields and when submitted the data is sent to session as $startMiles01, $startMiles02 … $startMiles31.
However, the value being displayed on screen is the $displayDate data i.e. 01, 02 … 31.
Can somebody see where my value=” code is incorrect?