Hi all, I’m trying to echo a field in a foreach loop and make the field name increment each time so I would have fields ‘name1’, ‘name2’, etc. Tried having a go but can’t seem to make it work. Think I’m pretty close but I must be doing something not quite correct.
while ($row = mysql_fetch_array($search)){
echo '<div class="searchRes">
<span class="searchRow" style="width: 20px;">'.$row['customer_ref'].'</span>
<span class="searchRow" style="width: 65px;">'.$row['c_title'].' '.$row['c_firstname'].' '.$row['c_lastname'].'</span>
<span class="searchAddress" style="width: 100px;">'.str_replace(",",",<br/>", $row['c_address']).'</span>
<span class="searchRow" style="width: 70px;">'.$row['c_number'].'</span>
<span class="searchRow" style="width: 115px;">'.$row['c_email'].'</span>
<span class="searchRow" style="width: 60px;">'.$row['c_dob'].'</span>
<span class="searchRow" style="width: 100px;">'.$row['c_regdate'].'</span>
<span class="searchRow" style="width: 70px;">'.$row['c_notes'].'</span>
<span class="searchRow" style="width: 700px; margin-top: 10px;">
<span class="searchRow"><a href="createorder.php?id='.$row['customer_ref'].'">Add Order</a></span>
<span class="searchRow"><a href="editcust.php?id='.$row['customer_ref'].'">Edit Customer</a></span>
<span class="searchRow"><a href="deletecust.php?id='.$row['customer_ref'].'">Delete Customer</a></span>
<span class="searchRow"><a href="orderhistory.php?id='.$row['customer_ref'].'">View Order History</a></span>
</span>
</div>';
foreach (range(0, $row['customer_ref']) as $key) {
echo '<input type="hidden" value="" name=""><input type=\\'submit\\' name=\\'delete'.$key.'\\' onclick="return confirm(\\'Do you want to make these changes ?\\');"></span>';
}
}