| | |
using variable substitutions in conditional statements
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 73
Reputation:
Solved Threads: 1
Hi,
I don't know if I have just been working too much or have gone brain dead (or both), but the solution to this eludes me.
I am using PHORM ( a PHP form processor) which uses variable substitution to allow you to quickly create user interaction pages etc. What I am doing here is creating an application over two pages. On the first page, we are collecting membership application info, including the type of membership and how they would like to pay for their membership (PayPal or invoicing). How PHORM works is that when you submit the form, the output is sent to the phorm.php script which does certain things, depending on the config for that form. In this case, it sends an email to the site owner, a confirmation email to the user and then redirects them to an acknowledgment page (page 2 of our little app). What I want is for all of this to happen as stated but, on the acknowledgment page, based on on the type of membership and payment preferences, build a Paypal button to submit the appropriate payment or, if they are being billed, simply indicate that they will receive an invoice via mail or email, as the case may be.
PHORM uses variables in the form of {{field name from form}}. So in our case here, the values that I need are available on the acknowledgment page as {{howPay}} and {{appType}}. However, I am trying to use variations on the following in order to show or not show certain info on the page:
or but with no success. In the first case, when you look at the code, you just see which does not seem to work. I even tried: but that does not work either.
I would appreciate a fresh pair of eyes on this and a fresh brain.
Thanks
Dave
I don't know if I have just been working too much or have gone brain dead (or both), but the solution to this eludes me.
I am using PHORM ( a PHP form processor) which uses variable substitution to allow you to quickly create user interaction pages etc. What I am doing here is creating an application over two pages. On the first page, we are collecting membership application info, including the type of membership and how they would like to pay for their membership (PayPal or invoicing). How PHORM works is that when you submit the form, the output is sent to the phorm.php script which does certain things, depending on the config for that form. In this case, it sends an email to the site owner, a confirmation email to the user and then redirects them to an acknowledgment page (page 2 of our little app). What I want is for all of this to happen as stated but, on the acknowledgment page, based on on the type of membership and payment preferences, build a Paypal button to submit the appropriate payment or, if they are being billed, simply indicate that they will receive an invoice via mail or email, as the case may be.
PHORM uses variables in the form of {{field name from form}}. So in our case here, the values that I need are available on the acknowledgment page as {{howPay}} and {{appType}}. However, I am trying to use variations on the following in order to show or not show certain info on the page:
PHP Syntax (Toggle Plain Text)
<?php if ({{howpay}} == paypal) { ?>
PHP Syntax (Toggle Plain Text)
<?php if ($_POST['howpay'] == paypal) { ?>
PHP Syntax (Toggle Plain Text)
<?php if (paypal == paypal) { ?>
PHP Syntax (Toggle Plain Text)
<? $pay = {{howpay}} ?>
I would appreciate a fresh pair of eyes on this and a fresh brain.
Thanks
Dave
-1
#2 34 Days Ago
Do you need to enclose paypal within quotes?
This is a templating engine I take it.
This is a templating engine I take it.
PHP Syntax (Toggle Plain Text)
<?php if({{howpay}} == "paypal"){ ... } ?>
Last edited by ardav; 34 Days Ago at 4:11 pm.
Happy Humbugging Christmas
•
•
Join Date: Nov 2008
Posts: 73
Reputation:
Solved Threads: 1
0
#3 34 Days Ago
•
•
•
•
Do you need to enclose paypal within quotes?
This is a templating engine I take it.
PHP Syntax (Toggle Plain Text)
<?php if({{howpay}} == "paypal"){ ... } ?>
Phorm is not really a templating engine. It is simply a big PHP script that handles various types of form submits. See http://www.php-form.net
Dave
0
#4 34 Days Ago
•
•
•
•
I have tried using quotes but that did not work either.
Phorm is not really a templating engine. It is simply a big PHP script that handles various types of form submits. See http://www.php-form.net
Dave
How about:
PHP Syntax (Toggle Plain Text)
if($_POST[{{howpay}}] == "paypal") ...
If so, I fail to see the use of the variable name swapping.
Can you do a print_r($_POST)?
That should give you the name of all the form posted variable keys and values.
Hmm, just thought, I expect you are passing variables via POST and not GET.
Happy Humbugging Christmas
![]() |
Similar Threads
- Variable Question maybe a function.. (Python)
- delphi object casting (Pascal and Delphi)
- tolower()'d cstrings in conditional statements (C++)
- customized right-click menu based on id (JavaScript / DHTML / AJAX)
- Is This The Correct Way To Do This..Can You Help Me. (Python)
- new programmer stuck with 'if statements.. (C++)
Other Threads in the PHP Forum
| Thread Tools | Search this Thread |
.htaccess ajax apache api array arrays beginner binary broken cache cakephp checkbox class cms code confirm cron curl customizableitems database date display dynamic echo email error external file files folder form forms forum function functions google headmethod href htaccess html iframe image include insert integration ip java javascript joomla limit link login loop mail malfunction menu mlm mod_rewrite multiple mysql neutrality oop paypal pdf php phpmysql play problem query question radio random recursion regex remote root script search select server sessions sms soap source space sql syntax system table tutorial update upload url validation validator variable video web xml youtube






