How to send parameter in php

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

How to send parameter in php

Post 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
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I believe you would do something like this...

Code: Select all

<input name="myfile" type="file" onChange="SubmitMe(this.form.elementName.value)" > 
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post 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.
Post Reply