Jump to content


PHP with Javascript message box

  • Please log in to reply
1 reply to this topic

#1 robcrozier

  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 13 April 2006 - 01:41 PM

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:
echo"<a href='delete_entry.php?title=$nt[title]'>Delete this entry</a>";

any help would be appreciated!


#2 wisewood

  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 13 April 2006 - 01:49 PM

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]?>"

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.

wisewood: proven fact, I am both wise, and wooden.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users