Re: combining PHP with JS

From: Date: Wed, 20 Apr 2011 15:52:48 +0000
Subject: Re: combining PHP with JS
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-312460@lists.php.net to get a copy of this message
On Wed, Apr 20, 2011 at 11:48 AM, Grega Leskovšek <legrega@gmail.com> 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

« previous php.general (#312460) next »