Jump to content

Archived

This topic is now archived and is closed to further replies.

robcrozier

PHP with Javascript message box

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.