Ah yes I got it wrong. It's not a PHP problem but anway:
Does it have to be a form button? It would be easier with a link as forms don't have target attributes. Anyway if it does need to be a form, put a button in frame a
<form><input type="submit" name="submit" value="submit"><input type="hidden" name="example" value="examplevalue"></form>
and then add an onsubmit handler to the button: onsubmit="return runmyjavascriptfunction()"
The Javascript function will need to trap the form submission, return it false, and then do
document.frames['framename'].location.href = 'frameb.php?example='+document.forms[0].example.value
or something similar. To return the form false you need to have the function return false. This will stop the form actually submitting (since we've sent the data via Javascript)
Check out the Netscape guide to Javascript if you need some pointers
http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/
I haven't tested the syntax for the above so it might need fixing 🙂
hth