Wednesday, February 23, 2011

how to run javascript in a php script?

I really wanted to do all along is EXECUTE A PHP FUNCTION on the click of the 'addSession' button. As you saw before I tried to execute a javascript function on clicking the button and then using PHP within that javascript function. Based on your previous post I dont think that will work. Do you know of any way to execute a PHP function (say, phpFunction($num) below) on the click of a button?

link href="file:///C:%5CDOCUME%7E1%5Cuser%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml" rel="File-List" link style

/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
style
html
div class="MsoNormal"
script language="JavaScript"
function echoSession(num)
{
window.document.newForm.mybox.value=num;

}



require("functions.php");
adminHeader($cookie);
makeConnection();

function phpFunction($num)
{
echo("TR TD SELECT NAME='signUpListDay[$num]' ");
echoDays();
echo(" SELECT  TD ");
echo("TD SELECT NAME='signUpListTime[$num]' ");
echoTimes();
echo(" SELECT  TD");
echo(" TD  INPUT TYPE=TEXT NAME='signUpListLocation[$num]' SIZE=40  TD ");
echo("TD INPUT TYPE=TEXT NAME='signUpListWeeks[$num]' SIZE=15 TD ");
echo("TD a href='#' onClick=\"window.document.newForm.elements['signUpListDay[$num]'].value='';
window.document.newForm.elements['signUpListTime[$num]'].value='';
window.document.newForm.elements['signUpListLocation[$num]'].value='';
window.document.newForm.elements['signUpListWeeks[$num]'].value='';\" Reset a TD TR");
}

$numSessions=1;

echo("INPUT TYPE=BUTTON onClick=\"echoSession(".$numSessions.");\" NAME='addSession' VALUE='Add a session!' ");

?>
htm div
div

No comments:

Post a Comment