robcrozier Posted April 13, 2006 Share Posted April 13, 2006 hi does anyone know how i can create an 'ok' 'cancel' confirmation box in javascript than when the 'ok' button is clicked it pases a variable through the url to another php page?I know how to pass the variable through the url with php when a link is clicked on, however im a bit stumped when it comes to incorporating a javascript message box too!heres the code i use to pass the variable normally:[code]echo"<a href='delete_entry.php?title=$nt[title]'>Delete this entry</a>";[/code]any help would be appreciated!cheers! Link to comment https://forums.phpfreaks.com/topic/7307-php-with-javascript-message-box/ Share on other sites More sharing options...
wisewood Posted April 13, 2006 Share Posted April 13, 2006 Something like this should give you a clue.Put this in the head section of the document which contains the popup.<script type="text/javascript"><!--function redirect(){window.location = "your_document.php?id=<?=$_GET[id]?>"}//--></script>you can then use onClick='redirect();' assigned to whatever you want, and it'll redirect you to the apge specified in the window.location.Hope this helps.PS. If you need to do a javascript popup, just google it. Link to comment https://forums.phpfreaks.com/topic/7307-php-with-javascript-message-box/#findComment-26591 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.