0

I have pretty simple code

<input type="hidden" name=passtophp value=variable>

The variable is created in javascript in the head of the document. Unfortunately when I put in the variable name it is captured as a string and passed through instead of the variable's actual value. How can I pass through the variable's value? Thank you!!

1
  • Can't tell what you're asking here. Needs more code. Commented Jul 20, 2010 at 18:18

1 Answer 1

3
var myVariable = 'myValue';
document.getElementById('passtophp').value = myVariable ;

Ensure you specifty an ID on the hidden field though.

<input type="hidden" name='passtophp' id='passtophp' />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.