// Encrypt the plaintext string for inclusion in the hidden field
$strCrypt = Shop_ProtxPayments::base64Encode(Shop_ProtxPayments::SimpleXor($strPost, $strEncryptionPassword));
#################################################################################
## END OF CRYPT BUILDER
#################################################################################
$protx_form_div = new HTMLTags_Div();
$protx_form_div->set_attribute_str('id', 'paypal_form_div');
$protx_form = new HTMLTags_Form();
$protx_form_action = new HTMLTags_URL();
//$protx_form_action->set_file('https://ukvps.protx.com/vspgateway/service/vspform-register.vsp'); # The real thing
//$protx_form_action->set_file('https://ukvpstest.protx.com/vspgateway/service/vspform-register.vsp'); # The sandbox
$protx_form_action->set_file($strPurchaseURL);
# The URL set above
$protx_form->set_action($protx_form_action);
$protx_form->set_attribute_str('method', 'POST');
$protx_form->add_hidden_input('VPSProtocol', '2.22');
$protx_form->add_hidden_input('TxType', $strTransactionType);
$protx_form->add_hidden_input('Vendor', $strVSPVendorName);
$protx_form->add_hidden_input('Crypt', $strCrypt);
$protx_submit_input = new HTMLTags_Input();
$protx_submit_input->set_attribute_str('type', 'submit');
$protx_submit_input->set_attribute_str('value', 'Go to Secure Server');
$protx_form->append_tag_to_content($protx_submit_input);
foreach ($protx_form->get_hidden_inputs() as $hidden_input) {
    $protx_form->append_tag_to_content($hidden_input);
}
$protx_form_div->append_tag_to_content($protx_form);
/*
 * Example of ProTx Form
 */
//<form
$customer_regions_table = $database->get_table('hpi_shop_customer_regions');
$shopping_baskets_table = $database->get_table('hpi_shop_shopping_baskets');
$shopping_baskets_table_renderer = $shopping_baskets_table->get_renderer();
$paypal_form_div = new HTMLTags_Div();
$paypal_form_div->set_attribute_str('id', 'paypal_form_div');
$paypal_form = new HTMLTags_Form();
$paypal_form_action = new HTMLTags_URL();
//$paypal_form_action->set_file('https://www.paypal.com/cgi-bin/webscr'); 	# The real thing
$paypal_form_action->set_file('https://www.sandbox.paypal.com/cgi-bin/webscr');
# The sandbox
$paypal_form->set_action($paypal_form_action);
$paypal_form->set_attribute_str('method', 'post');
// Overall Settings
$customer_region = $customer_regions_table->get_row_by_id($_SESSION['customer_region_id']);
$currency = $customer_region->get_currency();
$paypal_form->add_hidden_input('cmd', '_cart');
$paypal_form->add_hidden_input('upload', '1');
//$paypal_form->add_hidden_input('business', '*****@*****.**');	# The Real Thing
$paypal_form->add_hidden_input('business', '*****@*****.**');
# The Sandbox
$paypal_form->add_hidden_input('currency_code', $currency->get_iso_4217_code());
$paypal_form->add_hidden_input('custom', session_id());
# NOTIFY URL -urlencode, + it can only have one get variable
$secret = 'shhhh';
$paypal_form->add_hidden_input('notify_url', 'http://testing.connected-films-shop.vafan.clearlinewebdesign.com/?section=plug-ins&module=paypal-payments&page=paypal-ipn&type=txt&secret=shhhhh');
// Shopping Cart Items
$shopping_baskets = $shopping_baskets_table->get_shopping_baskets_for_current_session();
$i = 1;
foreach ($shopping_baskets as $shopping_basket) {
    // name
    $product = $shopping_basket->get_product();
 /**
  * Little helper function that sets the GET vars for the results
  * page of the selection criteria.
  *
  * The results page is the products page.
  */
 private static function add_hidden_inputs_for_results_page_get_vars_to_tag_selection_form(HTMLTags_Form $form)
 {
     $form->add_hidden_input('section', 'plug-ins');
     $form->add_hidden_input('module', 'shop');
     $form->add_hidden_input('page', 'products');
     $form->add_hidden_input('type', 'html');
     /*
      * Not really necessary because of the way references work
      * but still...
      */
     return $form;
 }