PHP plus JavaScrip Confirm Box
Posted: Sun Sep 07, 2008 2:20 pm
I am having a hard time figuring out how to use this piece of Javascript to return the value to a php variable. The following code will create an OK / Cancel message box in javascript. However, I would like to return which was chosen to a php variable. I know this can be done, I'm just not sure how.
It needs to be something like <script><?php $answer = ?> confirm(\"Delete?\");</script> but within an echo statement too!
Can someone help please?
It needs to be something like <script><?php $answer = ?> confirm(\"Delete?\");</script> but within an echo statement too!
Can someone help please?
Code: Select all
echo "<script>confirm(\"Are you sure you want to delete?\");</script>";//creates message box
//It needs to be something like
echo " ?><script><?php echo '$answer =' ?> confirm(\'Are you sure you want to delete?\');</script> <?php echo ";?> but within an echo statement too!