yes/no dialog

[email protected] (Michael Kolakowski) Tue, 24 Oct 2006 16:33:20 -0600
Newsgroups php.smarty.general
Message-ID <[email protected]>
Hi,

I am new to both PHP and Smarty.  Also new to JavaScript, for that 
matter. ;)  Anyhow, I am trying to create a yes/no dialog and am having 
a lot of trouble.  Could I please get some help?

My php code looks a little like this:

if($variable != NULL)
{
   //do a sql insert statement here
}
else
{
   //ask user if they really want to 'overwrite'    <-- yes/no goes here!!
  
   //if yes, then do sql update statement
   //else, do nothing
}

So, I want the yes/no dialog to pop up in that else block.  Using 
JavaScript was suggested, but I have not been able to figure out how to 
get the value of the yes/no (I got the pop-up by using a php print 
statement).  In addition, I have a number of variables above the if 
block that are used for the sql statements.  I don't want to 'lose' 
these variable due to POST or whatever else.  I'd also like to avoid 
complex logic to pass them around between the template and php files.  
Ideas?

Thanks,
Michael Kolakowski
HPC-1