+echo "BEGIN:VCARD\r" >"$tempfile"
+echo "VERSION:4.0\r" >>"$tempfile"
+for field in $VCF_FIELDS; do
+ value="$_POST[\"$field\"]"
+ n=0
+ while [ -n "$value" ]; do
+ echo "${field}:${value}\r"
+ value="$_POST[\"$field$n\"]"
+ n=$(($n + 1))
+ done
+done >>"$tempfile"
+
+case "$_POST[\"action\"]" in
+ addfield)
+ echo "$_POST[\"newfield\"]:\r" >>"$tempfile"
+ echo "END:VCARD\r" >>"$tempfile"
+ echo -n "Location: http://$HTTP_HOST/?page=attendees&edit=$card#$card\n\n"
+ ;;
+ update)
+ echo "END:VCARD\r" >>"$tempfile"
+ mv "$tempfile" "$cardfile"
+ echo -n "Location: http://$HTTP_HOST/?page=attendees#$card\n\n"
+ ;;
+ cancel)
+ rm "$tempfile"
+ echo -n "Location: http://$HTTP_HOST/?page=attendees#$card\n\n"
+ ;;
+esac