HOW: get the value of confirm message box with PHP?

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
victhour
Forum Commoner
Posts: 38
Joined: Fri Feb 17, 2006 12:59 am
Contact:

HOW: get the value of confirm message box with PHP?

Post by victhour »

hello guys,

could anyone show me how to the value of confirm box with ("or pass the value to") PHP?

ex: confirm("Are you sure you want...")

hope anyone would reply to this...

many tanx again in advanced...
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

confirm() is a client-side function, it runs "in" the browser. php is (mainly) a server-side language, it's not aware of what the client does client-side.
Please explain in more detail what you're trying to achieve.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

by the way, it either returns TRUE or FALSE in javascript. Use something like:

Code: Select all

if(confirm('are you sure????')) // do something
Returning FALSE during the onclick event of an Anchor (<a>) element will cancel the navigation...that's how I use it most often.
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

If asking for deletion, I tend to create a hidden input field in the form with a value of 1 e.g <input type='text' name='del_conf' value=1 /> when the user confirm the deletion (using javascript). Only when my PHP form processing finds this value does it delete anything. Catering for those people who do not use javascript is another problem,
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

I just attach a "confirm" to the link s above, so no javascript = no extra warning, but the functionality survives.
visitor-Q
Forum Commoner
Posts: 72
Joined: Mon Feb 05, 2007 1:40 am

Post by visitor-Q »

Post Reply