Re: combining PHP with JS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 20, 2011 at 11:48 AM, Grega LeskovÅek <legrega@xxxxxxxxx> wrote:
> I have case sentences in PHP and on certain step I want to ask user if
> he wants to save the Âfile.
> IF this is true I would do nothing, but if he doesn't want to save it
> I want to trigger break; in PHP not to do the next case sentence where
> I save the file.
> I've tried this, but it wouldn't even trigger confirm and I do not
> know where is/are mistake-s?
> Please help me. Here is an excerpt:
>
>
> <?php
>
> case 'm': #change mode ->that's autosave
> $changeMode = $_SESSION['adminType'];
> $_SESSION['adminType']=$userType;
> ?>
> <script type="text/javascript">
> var answerSave = confirm("Save?");
> if (!answerSave){
> <?php
> break;
> ?>
>
> }
> </script>
> <?php
> case 's': #start of save file
>
>
> -- When the sun rises I receive and when it sets I forgive ->
> http://moj.skavt.net/gleskovs/
> Always in Heart, Grega LeskovÅek
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

It doesn't work that way. PHP runs on the server and JS on the client.

What I do in this case is automatically save the file, then ask the
user if they want to download that file via link. The only other
option is to stream the file to the client as you are looping thru the
results. This is sometimes problematical with Internet Exploder, which
is why I save the file...

-- 

Bastien

Cat, the other other white meat

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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux