array(48) { ["mc_gross"]=> string(6) "189.99" ["protection_eligibility"]=> string(8) "Eligible" ["address_status"]=> string(9) "confirmed" ["item_number1"]=> string(25) "SW-RC-LIC-CAD-CAM-LUX-MIL" ["payer_id"]=> string(13) "ESVRNTQ553LAA" ["tax"]=> string(4) "0.00" ["address_street"]=> string(16) "1 Maire-Victorin" ["payment_date"]=> string(25) "11:35:40 Sep 29, 2016 PDT" ["payment_status"]=> string(9) "Completed" ["charset"]=> string(12) "windows-1252" ["address_zip"]=> string(7) "M5A 1E1" ["mc_shipping"]=> string(4) "0.00" ["mc_handling"]=> string(4) "0.00" ["first_name"]=> string(4) "test" ["mc_fee"]=> string(4) "5.81" ["address_country_code"]=> string(2) "CA" ["address_name"]=> string(6) "Bot201" ["notify_version"]=> string(3) "3.8" ["custom"]=> string(0) "" ["payer_status"]=> string(8) "verified" ["business"]=> string(32) "fritzson-facilitator@routcad.com" ["address_country"]=> string(6) "Canada" ["num_cart_items"]=> string(1) "1" ["mc_handling1"]=> string(4) "0.00" ["address_city"]=> string(7) "Toronto" ["payer_email"]=> string(26) "fritzson-buyer@routcad.com" ["verify_sign"]=> string(56) "AFcWxV21C7fd0v3bYYYRCpSSRl31A9-7ybxZr8LpDRkryv37.Mw9gGLx" ["mc_shipping1"]=> string(4) "0.00" ["tax1"]=> string(4) "0.00" ["txn_id"]=> string(17) "7PL302584W352844D" ["payment_type"]=> string(7) "instant" ["payer_business_name"]=> string(6) "Bot201" ["last_name"]=> string(5) "buyer" ["item_name1"]=> string(45) "RoutCad de Luxe CAD-CAM Mill Software License" ["address_state"]=> string(7) "Ontario" ["receiver_email"]=> string(32) "fritzson-facilitator@routcad.com" ["payment_fee"]=> string(4) "5.81" ["quantity1"]=> string(1) "1" ["receiver_id"]=> string(13) "3VWHDSA7BFD3A" ["txn_type"]=> string(4) "cart" ["mc_currency"]=> string(3) "USD" ["mc_gross_1"]=> string(6) "189.99" ["residence_country"]=> string(2) "CA" ["test_ipn"]=> string(1) "1" ["transaction_subject"]=> string(0) "" ["payment_gross"]=> string(6) "189.99" ["auth"]=> string(87) "AnWhC8wg7Dav7G4V4T0jk8ZRy2DPYLJbUfw7T6dy.6qqIcByqp-WU68LbDLqm7mHptuJzG1xKNH63UPK4mngZNw" ["form_charset"]=> string(5) "UTF-8" }
69.70.233.170
&quantity=
http://www.facebook.com/sharer.php?&t=FOOBAR&u=http%3A%2F%2Fwww.foobar.com%2F%3Ffirst%3D12%26sec%3D25%26position%3D
You can do this easily in most languages - in javascript:
var encodedParam = encodeURIComponent('www.foobar.com/?first=1&second=12&third=5');
// encodedParam = 'http%3A%2F%2Fwww.foobar.com%2F%3Ffirst%3D12%26sec%3D25%26position%3D'
(there are equivalent methods in other languages too)
shareimprove this answer
answered Feb 23 '11 at 19:21
Dexter
10.7k33350
add a comment
You have to escape the & character. Turn your
&
into
&
and you should be good.
You are missing the ? in the second URL (Also, it should be URL-encoded to be %3F).
Also, I believe that the remaining & need to be URL, not HTML-encoded. Change &second=12&third=5 to %26second=12%26third=5 and everything should just work.
This:
&u=http://www.foobar.com/first=12&sec=25&position=2
should be:
&u=http://www.foobar.com/%3Ffirst=12%26sec=25%26position=2
There's a few errors that I can see.
You can't use $_GET['quantity'] if the user is entering it in without reloading the page (Remember, PHP is not client-side). Thus, I suggest using JavaScript for that.
Javascript:
function buildUrl(a) {
var qty = document.getElementById("qty").value;
a.href = "./shopping-cart.php?part_id="+
+"&quantity="+qty;
}
As you no longer need to get a PHP variable from the current page, the form is obsolete and a simple link will do.
HTML:
Enter the Quantity you want:
//onclick attribute triggers the JavaScript
shareimprove this answer