Page 1 of 1

How to send parameter in php

Posted: Wed Dec 13, 2006 2:30 am
by eshban
how can i pass hidden value as a parameter on ONCHANGE event. And then how to access it.

like

Code: Select all

<input name="myfile" type="file" onChange="SubmitMe()" >
I want to send any vlaue as a parameter in the method SubmitMe() and how can i access that value. plz help

Thanks

Posted: Wed Dec 13, 2006 2:46 am
by Luke
I believe you would do something like this...

Code: Select all

<input name="myfile" type="file" onChange="SubmitMe(this.form.elementName.value)" > 

Posted: Wed Dec 13, 2006 11:33 am
by Ollie Saunders
You'll probably want to just pass this and extract what you need inside the function being overly specific is a bit of a design smell (see sig)

Code: Select all

function submitMe(node)
{
    alert(node.value);
}
</script>
<input name="myfile" type="file" onChange="submitMe(this)" />
also I hope you realise this but you can only use JavaScript code in the HTML intrinsic events such as onChange and not PHP.