please help. i want pass variables from a php form to an online shopping payment systems

this is the url i have
Pricing=<?php echo"$price";?>"
the url links the php form to the swreg.org but it doesn't transfer the price.
how can i modify the code to transfer the price obtained from the php form

Dani AI

Generated

Short summary and what likely happened: the payment endpoint never received a valid numeric price because the server-side value was either unset or concatenated incorrectly. was right to suspect the variable had no value, spotted the URL truncation/quoting issue, and ’s reminder about reading request parameters helps verify what the gateway actually receives. Since later confirmed it worked, the root cause was probably fixing how the price was set and encoded before sending.

Practical checklist to make this robust:

  • Always determine the price on the server (do not trust client-sent price).
  • Validate and coerce it to a numeric value, then format to two decimals.
  • Build query strings with a helper (do not concatenate by hand).
  • Prefer POST to GET if the gateway supports it, and use HTTPS.
  • Log the exact outgoing payload when testing so you can see what the provider receives.

Example (safe building of the outgoing request):

$price = isset($price) ? (float)$price : 0.00;
$params = [
  's' => '133537',
  'p' => '133537-2',
  'q' => 1,
  'v' => 0,
  'd' => 0,
  'Pricing' => number_format($price, 2, '.', '')
];

$endpoint = 'PAYMENT_ENDPOINT';
$url = $endpoint . '?' . http_build_query($params);
// then redirect the user or POST the data server-side

Security and debugging notes: never rely on a client-modifiable price—send only a product ID and compute the final amount server-side or sign the parameters (HMAC) and verify on return. Use the gateway’s server-to-server confirmation (IPN or similar) where available. For debugging, write the built URL and gateway response to your server logs (error_log or a temporary file) so you can compare what you built with what the provider actually received.

Recommended Answers

All 4 Replies

Hard to tell if you do not show your code. Most likely $price does not get a value.

I think so you are expecting something like this:-
URL:-"HTTP://www.daniweb.com?thread=34"
So to read this URL you have touse it in this way:-

<? echo $_GET['thread']?>

Hope this is clear....

Not sure if it is a typo in your post but you URL isn't sending the price - it finishes at &Variable and also the $price variable should not be in speech marks. If this isn't a typo (I am not sure what value should be attached to Variable so I have removed for now) you should have

<?php echo $price;?>"

thanks alot Junior Poster finally it has worked

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.