I've read the docs but I can't seem to get this to work properly. I want to edit a single address on a separate page from where all addresses for a customer are listed. I have the link to the edit page, which looks like this:
<a href="{{ url('account/edit-address') }}?addressId={{ address.id }}">Edit</a>
Then on that edit-address template I have the following:
{% set addressId = craft.request.getParam('addressId') %}
<form method="post">
{{ getCsrfInput() }}
<input type="hidden" name="action" value="commerce/customerAddresses/save">
<input type="hidden" name="redirect" value="account/address-book">
{% if addressId %}
<input type="hidden" name="address[id]" value="{{ addressId }}">
{% endif %}
<input type="text" name="address[firstName]" value="{{ address ? address[firstName] : '' }}">
<input type="text" name="address[lastName]" value="{{ address ? address[lastName] : '' }}">
</form>
That leads to a "Variable 'address' does not exist" error. I understand why I get that error but I'm not sure how to get the value field to show the address info. Having a blank form field isn't going to cut it.