Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Javascript function in PHP

Status
Not open for further replies.

math

Programmer
Mar 21, 2001
56
BE
hi,

I've got a problem...
I need a pag where the user can fill in a pag-number and when it's checked, a NEW window should open with another page inside...

here's my code:
Code:
<HTML>
<HEAD>
<TITLE>Search on page-number</TITLE>
<SCRIPT Language=&quot;Javascript&quot;>
function Get(url)
{
options = toolbar=0,menubar=0,location=0,scrollbars=0,resizable=0;
window.open(url,options);
}
</SCRIPT>
</HEAD>
<BODY>
<?php
if (!IsSet($number))
{
 $nummer=&quot;&quot;;
}
elseif ((!Is_Int($number)) && ($Number <= 130) && ($Number >= 6))
{
 $url = &quot;pag$Number/pag$Number.html&quot;;
print &quot;Get($url)&quot;;
Code:
}
 else {$fault=1;}
?>
<FORM Action=&quot;<?php print(&quot;$PHP_SELF&quot;); ?>&quot; METHODE=&quot;POST&quot;>
Fill a page-number in:
<INPUT type=&quot;text&quot; size=&quot;3&quot; name=&quot;Number&quot; value=&quot;<?php print(&quot;$Number&quot;); ?>&quot;>
<BR><INPUT type=&quot;submit&quot; value=&quot;GO&quot;></FORM>
<?php
 if ($fault)
 {
 print &quot;<B>Wrong input</B><P>&quot;;
 print &quot;Make sure you follow these rules:<BR>&quot;;
 print &quot;1. You <B>HAVE TO</B> fill in a number.<BR>&quot;;
 print &quot;2. IT <B>HAS TO</B> be a number between 6 and 130.<BR>&quot;;
 }
?>
</BODY>
</HTML>

I can't seem to call the function (see red in code)

Can anyone help,
math
 
hi,
u need to call the javascript function on the event of checking the checkbox or form submission.
so it will be something like this in the script where u are calling the script

<form name=somename action=script.php>
<input type=checkbox...onCheck=javascript:Get(<? echo $url; ?>)>
</form>

hope that will help you

spookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top