This topic is locked

If Then Statement in _view page

1/18/2007 1:35:16 AM
PHPRunner General questions
N
NancyGeek author

I am creating a donation database for a benefit. I created a new table view for the donations table called "THANKYOU_view.php"
ThankYou allows the donation chairperson to generate a thank you letter that will print on preprinted stationary for the benefit. As we have several committees (Food, Beer, TShirts, etc.) we would like to do something similar to this coding
{if $donationtype == 'Food'}Colleen will contact you to arrange for pickup.

{elseif $donationtype == 'TShirt'}Joe will provide a proof of your advertisement on the tshirt as soon as possible

{else}We will contact you as we get closer to the event for any last minute arrangements in relation to your donation.

{/if}
Every time I run it, I get the else phrase for a Food donation - which usually means it didnt validate the first 2 options. I'd also like to list the donations in the text of the letter. Each form has a max of 3 donations but many people only need one donation line. I would like to ignore the default values for many of the fields if the value of donation_b or donation_c is null.

Donation Quantity Value

donation_a donationqty_a donvalue_a

donation_b donationqty_b donvalue_b (dont create a new row here is donation_b is null)

donation_c donatinqty_c donvalue_c (dont create a new row here is donation_c is null)
Thank you so much...this product has been a wonderful tool to get us up and running.

Alexey admin 1/18/2007

Nancy,
use $show_donationtype variable instead of $donationtype.

I.e. the code should look like this:

{if $show_donationtype == 'Food'}Colleen will contact you to arrange for pickup.

{elseif $show_donationtype== 'TShirt'}Joe will provide a proof of your advertisement on the tshirt as soon as possible

{else}We will contact you as we get closer to the event for any last minute arrangements in relation to your donation.

{/if}


To send a email use Send email with new data sample action in Before record added on Events tab in PHPRunner.

Modify the code to send the fields you need only.