in script function the php code work or not??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mujaffar
Forum Newbie
Posts: 13
Joined: Tue Dec 22, 2009 11:16 pm

in script function the php code work or not??

Post 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:
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

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

Post by daedalus__ »

start by making sense.

are you putting php inside of a html script tag?
mujaffar
Forum Newbie
Posts: 13
Joined: Tue Dec 22, 2009 11:16 pm

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

Post by mujaffar »

daedalus__ wrote:start by making sense.

are you putting php inside of a html script tag?
Yes
this will work?? :idea:
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

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

Post by alex.barylski »

yes
mujaffar
Forum Newbie
Posts: 13
Joined: Tue Dec 22, 2009 11:16 pm

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

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