A bit of a strange way would be to always pop the window and at that point have the 
PHP decide what to put in there. If there is not offer you want to include you could 
simply thank them, or you could even produce an inline window.close(); javascript 
call. The only problem with that is that some browsers pop a message saying that the 
script is trying to close the window. I'd expect you to know upon hitting the checkout 
screen what you'd want to do so you could do the processing there and have the code 
decide whether to even pop the window.

Hope it's worth a cent or 2... :-)

<>< Ryan

-----Original Message-----
From: Petr Tomenendál [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 10:58 AM
Subject: Re: [PHP-DB] PHP in a javascript function with DB calls.

You cannot call PHP script from JavaScript in any simple way.
It can be possibly done by including JavaScript code generated
by PHP script through <script src="script.php"..., but it is too

I think it will be better to do this like this:

user have selected some items and goes to check out - his browser
requests new page with check out form for example checkout.php - 

your checkout.php can look like this:
<!-- test for related items (hockey stick - hockey tape) -->
<!-- your checkout code here -->

in part 'test for pop-up' you will check for items related to
currently selected items, and if your script find some items then
you can echo JavaScript code to open new window with additional items to
buy or show these items on the top of page before the checkout form. 

I hope this helps.


On Tue, 2002-09-10 at 17:20, Aaron Wolski wrote:
> Hi All,
> I HOPE this is the right place for this.. if not I am sorry!!!
> I'm hoping someone can put me on a clear path of how to do what I am
> asking here.
> I Have a shopping cart... and in this shopping cart I want to feature
> some items in a pop_up window when the user is ready to check out - if
> they are not already selected.
> For example.. Someone buy a Hockey Stick but don't buy hockey tape..
> when when they go to check out.. I want a pop_up to be launched asking
> the user if they want to add Hockey tape to their order for onlu $$$.
> For this to happen I need to have an onLoad on the checkout page that
> calls a javascript function that has PHP code to find out IF a
> paritcular product is selected to see if the other has been selected
> too, if it's NOT selected then launch the pop_up.
> Does ANYONE have any idea's as to how this can be accomplished??
> Anyhelp is appreciated!!!!
> thanks all.
> Aaron

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to