Re: Switch syntax
| From: | Philip Olson | Date: | Mon, 15 Oct 2001 18:51:28 +0000 |
| Subject: | Re: Switch syntax | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71128@lists.php.net to get a copy of this message | ||
I suggest you read this :
http://www.php.net/manual/en/language.variables.scope.php
http://www.php.net/switch
Also, jic, variable names are CaSe sensitive.
regards,
Philip Olson
On Mon, 15 Oct 2001, 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@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>