[eluser]jbibbings[/eluser]
Why is this bad practice?
I have users who can select multiple shipping addresses. There is a page that lists all of the addresses, and allows them to edit. In order to know which address to pull from the database, I need a reference.
Because this is a page that just lists the addresses, there is no form to post - just an edit button that uses an anchor tag and sends a get request.
Code:
<div class="addresses">
<ul>
<?php foreach($address as $row){ ?>
<li>
<h3><?php if(empty($row->addressname)){ echo "- Untitled -"; } else { echo $row->addressname; } ?></h3>
<div class="vcard"><span class="fn"><?php echo $row->contactname; ?></span>
<span class="email"><?php echo $row->recipientemail; ?></span>
<span class="tel"><?php echo $row->recipientphone ;?></span>
<span class="rext"><?php if(!empty($row->rext)) echo 'Ext.' . $row->rext; ?></span>
<span class="adr"> <span class="street-address"><?php echo $row->address1; ?></span>
<span class="extended-addres"><?php echo $row->address2; ?></span>
<span class="locality"><?php echo $row->city; ?></span>,
<span class="region"><?php echo $row->state; ?></span> <span class="postal-code"><?php echo $row->zip; ?></span> </span>
</div>
<!-- echo the address row onto the end of the edit and delete urls -->
<p class="action"><href="<?php echo site_url('account/edit_address/' . $row->address_id ?>" class="edit">Edit</a
<href="<?php echo site_url('account/delete_address/' . $row->address_id ?>" class="remove">Delete</a></p>
</li>
<?php } ?>
</ul>
</div>
How would you do this differently?