Jump to content

OOP syntax for setting the input type"image" for paypal button


telsiin

Recommended Posts

Ok this has probably been asked before  ,so if it has can you please point me the right direction

I am attempting to convert a PayPal button in to a class but I am not too familiar with OOP

 

So I have this from Micah Carrick IPN Integration Class

 

$p->add_field('cn', 'Add special instructions to the seller');

$p->add_field('no_shipping', '2');

$p->add_field('bn', 'PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted');

 

 

this the html code I need to convert  to add to class

<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">

 

$p->image('submit', 'src','https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif');

The Micah Carrick IPN Integration Class is not part of php, I'm not sure what exactly you want help with?

 

Considering your using some third party class, you might be best to seek help from said third party.

 

Or, at very least, post the add_field() method.

I am trying to learn the syntax

so I can create and/or modify a class for creating a button however I don't know how to set the different form element and their attributes in class syntax

 

On this page http://vailo.wordpress.com/2008/09/04/the-php-form-class-one-becomes-two/

they show example for the syntax for check box and text  but  not the image or radio and they don't give and example for the syntax for the different attribute such src,border,alt,. etc

Check boxes, text boxes, images, radio buttons are all html. There is no php syntax for creating them because they are client side elements. All php does is outputs strings.

 

Now, once again you are pointing to a third party class. Some type of form class. All this form class does is outputs strings (which happen to be strings of html to create forms + whatever else it does).

 

Being a third party class, you will need to read the docs on the class itself, it is not part of standard php.

ok I found that it was a custom function

 

  function add_field($field, $value) {

     

      // adds a key=>value pair to the fields array, which is what will be

      // sent to paypal as POST variables.  If the value is already in the

      // array, it will be overwritten.

           

      $this->fields["$field"] = $value;

  } :shrug:

 

I thought it was something specific to class I learn something every day

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.