Do you want to abandon the purchase? bottom doesn't work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
erico2008
Forum Newbie
Posts: 1
Joined: Mon Aug 11, 2008 12:22 pm

Do you want to abandon the purchase? bottom doesn't work

Post by erico2008 »

Hi, I am new in PHP codes, and now I am editing a web page. What I see is that when I try to return to a previous web page, I receive a message “Do you want to abandon the purchase?” and also I see the bottoms “Ok’ & “CANCEL”. But when I press “CANCEL”, the page is not abandoned but reloaded and puts the default options again.
How to make it to not reload the page and remains with the options I made, if I press CANCEL?
The code I see is:

<script language="javascript" type="text/javascript">
wend = "usr";
snow = 0;
frmurl = window.location;
window.onunload = endform;

function endform() {

if (wend == "usr") {
sure = confirm("¿Do you want to abandon the pruchase?");
if (sure == false) {
window.location = frmurl;
}
} else {
if (snow == 1) {
document.negfrm.submit();
}
}
}
</script>



Thanks!
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: Do you want to abandon the purchase? bottom doesn't work

Post by ghurtado »

1. This is not PHP code, it is Javascript

2. Please enclose code within "code" tags so that it is easier to read

3. Change this line:

Code: Select all

window.location = frmurl;
to

Code: Select all

//window.location = frmurl;
Post Reply