Annette Block schreef:
Hi Annette,
Quote:
I'm rather new in JavaScript, but I have some experience in php.
I learned it's rather easy to open a window of a specified size with
JavaScript, that you need to specify the opened file, but I don't see
how to do that in php.
Well, you let PHP just put in the right values for JavaScript to use.
Quote:
The file I want to open is "detail.php?item=$item". This generates a
query, which results in a table of at most 5x3 items. I want a window
size that is of an appropriate size. I tried:
<HEAD>
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
Leave out LANGUAGE="JavaScript".
Stop using the <!-- also. ;-)
Quote:
function NewWindow() {
window.open("detail.php?item=$item", "new", "width=500, height=300");
}
//-->
</SCRIPT>
- - - -
</HEAD>
and as hyperlink
<A HREF="detail.php?item=$item" TARGET="new" onClick="NewWindow();
return false;">details</A>
Excactly.
And you don't want $item of course, you want its value.
So why don't you put it there? Like this:
<A HREF="detail.php?item=<?php echo $item; ?>" TARGET="new"
onClick="NewWindow(); return false;">details</A>
Quote:
>
As a matter of fact I tried in the header more than just the example
shown, but no result. With this I came closest, getting a message that
my SQL syntax was wrong. Which isn't.
That means more is wrong.
I bet your SQL is vunurable to SQL injection.
If you from PHP take a value from the user, theat it like dangerous
stuff that will try to corrupt your database. Never trust it.
SO, do this:
$itemPassed = (int)$_GET["item"];
when you expect an integer.
If you expect a string, make sure you escape it well before feeding to
your database.
It is VERY EASY to pass a value that will delete everything in your
database.
Google for SQL injection for more info.
Quote:
>
I also tried setting the window size within the details.php. But then
all windows became of the same size.
SInce you didn't show us code that should do that, we cannot possibly
comment on it.
Quote:
>
I know that php is server-side and JavaScript is client-side.
Yes.
Quote:
>
Any help or hint will be appreciated.
Annette
Regards,
Erwin Moller
--
============================
Erwin Moller
Now dropping all postings from googlegroups.
Why?
http://improve-usenet.org/
============================