/    Sign up×
Community /Pin to ProfileBookmark

php prompt user

hey guys, i am displaying user from a db. i have a edit button and a remove button. both work. but for the remove button i would like to prompt the user to make sure he/she wants to remove that user. i was told to call a java script function but im not sure. how can i go about doing this?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@jignesh1Nov 14.2006 — for remove button u have something like this

<input type="button" value="Remove" onclick="javascriptfunction" />

javascript function could be on the same page or in javascript file

[CODE]
<script type="text/javascript">
var ans = confirm("The description to show user");

if(ans){
code for deleting
}else{
where ever u want to redirect the user
}
</script>
[/CODE]
Copy linkTweet thisAlerts:
@NogDogNov 14.2006 — Probably the simplest JavaScript solution would be something like this:

In the <head> section of the form page:
[code=html]
<script language="JavaScript" type="text/javascript">
function verify()
{
return(confirm("Are you sure you want to delete this user?"));
}
</script>
[/code]

For the <form> tag in the body of the document:
[code=html]
<form action="test.php" method="post" onsubmit="return(verify());">
[/code]
Copy linkTweet thisAlerts:
@keko2005authorNov 14.2006 — what i did was this
<i>
</i>function remove_prompt(ids)
{
var responce = confirm("Delete Adjunct?");
if(responce){
var url="$php_self?remove_function=remove_faculty&amp;id="+ids;
window.open(url, "_self");
}
}
×

Success!

Help @keko2005 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...