Jump to content

PHP with Javascript message box


robcrozier

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.