By mdayton on
I am trying to use a PHP GET snippet within an HTML form to capturing URL variable named "sandbox_id" and sending to Amazon Simple Pay services form. The PHP is totally stripped from my code when page is rendered by Drupal, yet it is visible when I edit the node content. I have PHP input enabled and selected (have also tried using Full HTML just for kicks).
I have already checked with Amazon techs and my hosting provider, HOTDrupal, but no one can tell me what is wrong. Here is the code for the form with the PHP snippet highlighted where I am trying to insert GET variables.
<form action="https://authorize.payments-sandbox.amazon.com/pba/paypipeline" method="post">
<input type="hidden" name="immediateReturn" value="1" /> <input type="hidden" name="collectShippingAddress" value="0" /> <input type="hidden" name="accessKey" value="11SEM03K88SD016FS1G2" /> <input type="hidden" name="referenceId" value="<?php $_GET['sandbox_id']; ?>" /> <input type="hidden" name="amount" value="USD 1" /> <input type="hidden" name="variableMarketplaceFee" value="" /> <input type="hidden" name="signature" value="H5aXejjIcx+mZiclKnDeOnUVjkQ=" /> <input type="hidden" name="isDonationWidget" value="0" /> <input type="hidden" name="fixedMarketplaceFee" value="" /> <input type="hidden" name="description" value="Basic Demo Sandbox Plan (TEST)" /> <input type="hidden" name="amazonPaymentsAccountId" value="NFWFHLXBZQKP3D6HD6Q3641GM14HMFUH39K8ZJ" /> <input type="hidden" name="ipnUrl" value="" /> <input type="hidden" name="returnUrl" value="http://dev01epmcloud.hynotetest.com/payment_success" /> <input type="hidden" name="processImmediate" value="0" /> <input type="hidden" name="cobrandingStyle" value="logo" /> <input type="hidden" name="abandonUrl" value="" /> <input type="image" border="0" src="http://g-ecx.images-amazon.com/images/G/01/asp/SMPayNowWithLogo.gif" />
</form>
Anybody have any ideas what I am doing wrong here?
[Moved to support - Heine]
Comments
Try print: <?php print
Try print:
<?php print $_GET['sandbox_id']; ?>PHP is dumb. Doesn't know that you want to put that value in the page.
PHP still being stripped out of rendered page
Thanks for responding. I added the print command as you suggested, but the entire PHP snippet is still being stripped out of the page when rendered by Drupal.
I don't know
...you mentioned "full html" ...have you got all tags you are using set in the HTML input types ? < form e.g.
PHP tag in HTML
I am not a coder, but have been trying to figure out how to do this by looking at other snippets. The only PHP code I am using within a larger HTML form is the highlighted code below:
<input type="hidden" name="referenceId" value="<?php $_GET['sandbox_id']; ?>" />When i view the page source from browser after it is rendered by Drupal, the entire PHP snippet is deleted completely. This is when i have enabled PHP input type.
When i enabled Full HTML type, the PHP code remains, but the leading "<?php" tag is rendered as "<?php". Not sure why the leading character is percent encoded, but probably to disable PHP when in HTML mode.
I am not familiar with the HTML version of PHP tag you mentioned. Should I be trying to handle the small PHP command via full html or php input methods?
I am not familiar either
all I can think is that if you are using php input type then
andshould be the first and last things you enterand when you are using full html input then
will not run.sorry I can't help you more on this one
What you describe sounds
What you describe sounds normal.
If you want your PHP code to be executed, don't expect to see the code in the rendered HTML, only expect it to run. Also don't expect it to produce any output if you only asked it to retrieve or calculate a value and not to print it.
1. Make sure that you have enabled the "PHP filter" module in admin/build/modules.
2. Go to the admin/settings/filters page, "configure" the "PHP code" input format, check the enabled filters that it contains, and make sure that the "PHP evaluator" filter is enabled and that all the other filters are disabled.
3. Edit your node, make sure that your PHP code contains a
printand that the "PHP code" input format is selected.Figured it out (user error and ignorance)
Thanks M13 and Cog for your help. The code is working and I am almost too embarrassed to tell you what the problem was. However, humility is a healthy thing most of the time. I was manually adding the querystring to the URL AFTER the page containing the PHP snippet had already loaded.
I am not a coder (even worse, i am a sales and marketing guy trying to impersonate a coder), but think I have just figured out the hard way that the php executes prior to the page rendering so anything i manually entered into URL would be ignored. When I created an actual link with the querystring included, and clicked the URL to get to the page containing the snippet, everything worked as planned.
I do think adding the print command made the difference, since I believe I had tested the real URL before the print command and didn't get the result I was looking for.
Thanks for you help and my apologies for wasting anybody's time.
I'm Also Stuck
Hi,
This thread was helpful to me. However, I'm currently stuck.
I am trying to use Dash Player to display videos in Drupal 5.
I have the following PHP code in a page, and am getting a page with just the code in it and the "printed" content.
Please help if possible.
Thanks,
Ofer Morag
Have you already tried steps
Have you already tried steps 2 and 3 of my previous reply?
- Only the php evaluator filter and no other filter enabled in the PHP input format.
- Your post has the PHP input format selected.
Hi, Thanks for your help. I
Hi,
Thanks for your help. I have double checked for those two terms.
I'm thinking that my PHP version is old. I installed the site about 1.5 years ago. I'm running Drupal 5.7.
I appreciate any help.
Ofer Morag
Use parentheses
The print function requires parentheses. Try one of the following:
--or--
'echo' does not require parentheses.