Hi all,

I know it sounds stupid (the title of this thread) but I am using php to write some hidden fields to a form and when the form is submitted some of the hidden fields are not being sent. They currently only work when google chrome, and do not work with IE(6), firefox or safari.

What the hell?!? :P Im stuggling to find the cause of this problem. Does anybody have an insight?

The form script i am using is below:

<form action="" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" target="_blank"> 
<input name="_charset_" type="hidden" value="utf-8"/>

<input name="item_name_1" type="hidden" value="Matt Clay Extreme Style V05"> 
<input name="item_description_1" type="hidden" value="Extreme Matt Clay from V05"/> 
<input name="item_quantity_1" type="hidden" value="1"/> 
<input name="item_price_1" type="hidden" value="5.00"/> 
<input name="item_currency_1" type="hidden" value="GBP"/> 

<input name="item_name_2" type="hidden" value="Polishing Wax Fructis Style Garnier"> 
<input name="item_description_2" type="hidden" value="A polishing style wax from garnier."/> 
<input name="item_quantity_2" type="hidden" value="2"/> 
<input name="item_price_2" type="hidden" value="4.00"/> 
<input name="item_currency_2" type="hidden" value="GBP"/> 

<!-- below are the fields that are not being submitted - google checkout ends up with NO shipping costs unless user is using google chrome -->
<input name="ship_method_name_1" type="hidden" value="Standard delivery"/> 
<input name="ship_method_price_1" type="hidden" value="9"/> 
<input name="ship_method_currency_1" type="hidden" value="GBP"/> 
<input type="submit" value="Continue to Google Checkout"> 
</form> 

<script language="javascript" type="text/javascript"> 
document.getElementById("BB_BuyButtonForm").submit();
//history.go(-1);
</script>

Thanks in advance,

Max.

Dani AI

Generated

reported that shipping-related hidden fields were arriving only when the page was submitted from Chrome while other browsers showed no shipping cost. That looks like a browser/markup interaction rather than a PHP server problem. Note that Google Checkout itself was retired in 2013, so any Google-specific behavior here is historical — modern work should use a current payment provider. (en.wikipedia.org)

Hidden inputs are normal form controls and are included in the POST body unless they are disabled, outside the form element, or their name/value are malformed. The first diagnostic step is to inspect the final DOM and the actual POST payload in each browser (Elements + Network panels). Look for missing name attributes, accidental whitespace in names (common with string concatenation bugs), inputs rendered outside the form, or the disabled attribute. The browser’s network request will show exactly which keys reached the server — that’s the single most useful evidence. (developer.mozilla.org)

Programmatic submission can behave differently across engines. Calling form.submit() bypasses a normal click in some cases and, on some browsers, the actual network send can be effectively delayed so subsequent script can change the DOM before the request goes out. Using requestSubmit() (which acts like a real button click and fires submit events) is the safer modern approach; include a small fallback for older browsers. Example fallback:

const f = document.getElementById('BB_BuyButtonForm');
if (typeof f.requestSubmit === 'function') f.requestSubmit();
else setTimeout(()=>f.submit(), 10); // small delay for older engines

For completeness: ’s note about parameter naming was on point — confirm the payment-provider parameter names exactly (different docs sometimes show different conventions). Reproduce the submit both manually and via script, compare POST bodies across browsers, and if POSTs still differ, try the requestSubmit approach or add a tiny delay. For historical Google Checkout work, plan to migrate to a supported gateway. (stackoverflow.com)

Recommended Answers

All 3 Replies

no luck with that post dickersonka :/

Also the problem with this is that google checkout will only accept the information through posted hidden fields with their specific parameters, and as far as I can see I have met all their requirements which is really wierd because it is still not working.

I *think* iv sent them an email about it but theyr crazy support system is ... well ... crazy.

Max

hmmm, haven't had experience with it

i see one page they say ship_method_1 and another they have a little different convention

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.