View Full Version : How do I ask a simple yes/no question in php
Can someone please tell me if it is possible for php to ask a simple message dialog where the user clicks on a "yes" or "no" button.
7-6-06, 07:47 PM
Not really. PHP is server-side, so you can't really interact with the visitor/browser (using PHP).
7-13-06, 09:13 PM
$yn = "yes";
$yn = $_POST["yn"];
You can then build the parallel functionality in an HTML option type lower on the page:
<form method="post" action-="thissamepage.php">
<tr><td>Answer Yes or No</td></tr>
<tr><td><input type="submit" value="Click"></td></tr>
If you do not need to store the result beyond the session you can skip setting up the MySQL part and just recapture the HTML response. Use MySQL only if you need to store the answer, for example in a client profile, beyond the session.
This is, by the way, how you might implement BWG's "or a form that is submitted" solution.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.