This topic is locked

popup prompt

10/8/2009 9:32:03 AM
PHPRunner General questions
G
garethp authorDevClub member

Hi
I have incorporate some popups into my site for the first time and this is really helpful using the following code...

echo "<script>alert('I\'m a popup window')</script>";


However this only gives the option to click OK. Is there anyway to have a yes/no or true/false or OK/cancel option and difference event scripts are run depending on which option is clicked?
Many thanks for all the help.
Gareth

D
danaci 10/8/2009

echo "<script>if(!confirm('are you sure?')){window.location.href='xxx_list.php?a=return'}</script>";

G
garethp authorDevClub member 10/8/2009

Hi
Thanks so much for your repsonse. I have managed to make the following work...

echo "<script>if(confirm('are you sure?')){window.location.href='req_header_list.php?a=return'}else{window.location.href='journal_header_list.php?a=return'}</script>";

exit();


However, what I am unsure is how do I execute different php code depending on which option was picked? Can I set a session variable that I could use in a if statement for example?
Many thanks again
Gareth

J
Jane 10/9/2009

Gareth,
you can add your PHP code to the List page: Before process events for req_header and journal_header tables.