Jump to content

Message Box


fallenangel1983

Recommended Posts

Hey all,

 

I have a button on a page and its purpose is to delete a ecord form a table.

 

Is there a way to have a essage box flash up saying...

 

are you sure you wish to delete?

 

and two options stating ok or cancel.

 

if ok is pressed then delete the record . if cancel is pressed do not delete just return to previous pge.

 

i have looked through the tutorials and an find nothing that relates to this. can you help.

 

cheers.

Link to comment
https://forums.phpfreaks.com/topic/98629-message-box/
Share on other sites

Here a php aproach, not all users have javascript turn on be carefull.........

 

Try it for fun.....

 

<?php session_start();

$_SESSION['name']="redarrow";

if($_POST['submit']){

if($_GET['cmd']=="delete"){

echo" PLEASE BE ADVISED DELETING ALL DATA PLEASE CONFIRM! <p></p>";


$self=$_SERVER['PHP_SELF'];

echo"
<form method='POST' action='$self?cmd=yes'>
<input type='text' value='".$_SESSION['name']."'>
<input type='submit' name='submit' value='CONFIRM DELETE'>
</form>";
exit;
}

if($_GET['cmd']=="yes"){

unset($_SESSION['name']);

echo" USERNAME DELETED! ".$_SESSION['name']." ";
exit;
}
}

$self=$_SERVER['PHP_SELF'];

echo"
<form method='POST' action='$self?cmd=delete'>
<input type='text' value='".$_SESSION['name']."'>
<input type='submit' name='submit' value='DELETE DATA'>
</form>";

?>

Link to comment
https://forums.phpfreaks.com/topic/98629-message-box/#findComment-504745
Share on other sites

Remember javascript/ajax is client side not server side hence script lanauage not

a programming lanuage........

 

Now let say 100 hits to my web site, let say only 1

out off 10 got javascript off, out off 100 people

that 10 people but guess what them 10 people wanted

to buy 10 exspensive items

i lost money havent i !

 

DO NOT RELY ON JAVASCRIPT!

Link to comment
https://forums.phpfreaks.com/topic/98629-message-box/#findComment-504760
Share on other sites

Archived

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

×
×
  • 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.