Page 1 of 1

in script function the php code work or not??

Posted: Thu Dec 31, 2009 1:14 am
by mujaffar
in script function the php code work or not??
i am confused
i am working on that & i seems that the function is not working :banghead:

Re: in script function the php code work or not??

Posted: Thu Dec 31, 2009 1:15 am
by daedalus__
start by making sense.

are you putting php inside of a html script tag?

Re: in script function the php code work or not??

Posted: Thu Dec 31, 2009 1:22 am
by mujaffar
daedalus__ wrote:start by making sense.

are you putting php inside of a html script tag?
Yes
this will work?? :idea:

Re: in script function the php code work or not??

Posted: Thu Dec 31, 2009 1:27 am
by alex.barylski
yes

Re: in script function the php code work or not??

Posted: Thu Dec 31, 2009 1:34 am
by mujaffar
PCSpectra wrote:yes
I am providing you the code in that when button insert clicked it want to print Insert clicked and when update is clicked it want to print update clicked
but this not work
how it done

<SCRIPT language="JavaScript">
function OnSubmitForm()
{
if(document.pressed == 'Insert')
{

<?php
echo "insert clicked";
?>
}
else
if(document.pressed == 'Update')
{
<?php
echo "update clicked";
?>
}
return true;
}
</SCRIPT>

<FORM name="myform" onSubmit="return OnSubmitForm();">

<INPUT TYPE="SUBMIT" name="Operation" onClick="document.pressed=this.value" VALUE="Insert">

<INPUT TYPE="SUBMIT" name="Operation" onClick="document.pressed=this.value" VALUE="Update">

</FORM>