Re: [PHP] Switch syntax From: Jason G. (blair <email protected>)
Date: 10/15/01

if($payment == 'Debit')

You just used one equals. That would assign 'debit' to $payment and return
'debit' which evaluates to TRUE.

-Jason Garber
IonZoft.com

At 01:54 PM 10/15/2001 +0200, Rudi Ahlers wrote:
>Hi
>
>I wonder if this is possible, and if it is, what am I doing wrong? I got a
>form, with either debit order details, or credit card details, both on the
>same form. But I have put the select box, the debit order form, and the
>credit card form in one file, and then users select it with an if statement,
>and it's then called with functions. This all works very well with:
>if ($Payment = 'Debit') {
> debit();
>} elseif ($Payment = 'Credit') {
> credit();
>} else {
> select();
>
>
>Now, I email the form to sales department, but I want the output to differ,
>depending on whether they selected debit order or credit card. I tried the
>following, bit it didn't seem to work.
>
>
>function bank_details()
>{
> switch ($Payment) {
> case "Debit":
> debitorder();
> break;
> case "Credit";
> creditcard();
> break;
> }
>
> function debitorder()
> {
> $bank_details = "AccountHolders Name: $account_holders_name\n";
> $bank_details .= "Account Number: $account_number\n";
> $bank_details .= "Bank Name: $bank_name\n";
> $bank_details .= "Branch Name: $Branch_name\n";
> $bank_details .= "Branch Number: $branch_number\n";
> $bank_details .= "Branch Number: $branch_number\n";
> }
>
> function creditcard()
> {
> $bank_details = "Card Holder: $CardHolder\n";
> $bank_details .= "Card Number: $CardNumber\n";
> $bank_details .= "CvvNumber: $CvvNumber\n";
> $bank_details .= "CardType: $CardType\n";
> $bank_details .= "CardMonth: $CardMonth\n";
> $bank_details .= "CardYear: $CardYear\n";
> }
>}
>
>I call bank_details() as follows:
>
>$content .="Firstname: $first_name\n
> Lastname: $last_name\n
> ID Number: $your_id_number\n
> Company Name: $company\n
> Postal Address: $postal_address_1\n
> Postal Address2: $postal_address_2\n
> Postal code: $postal_code\n
> Email: $email\n
> Work Phone: $work_phone_number\n
> Work Code: $work_phone_number_code\n
> Home Phone: $phone_home\n
> Home Code: $phone_home_code\n
> Faxn Nmber: $fax_number\n
> Fax Code: $fax_number_code\n
> Cell: $phone_cell\n
> Domain Name: $domain_name\n
> Hosting Option: $Hosting_option\n
> Upload Option: $Upload_option\n
> Application Description: $ApplicationDesc\n
> $bank_details
> $reseller
> Agreed: $agreed_with_the_terms_and_conditions\n";
>
>It doesn't seem to display the bank detail though, on either form. Is there
>anyway of getting this done?
>
>
>Regards
>Rudi Ahlers
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-general-unsubscribe <email protected>
>For additional commands, e-mail: php-general-help <email protected>
>To contact the list administrators, e-mail: php-list-admin <email protected>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>