Help with Contact Form security question choices

I realize this is old code (that I didn’t write) but works well for a temporary ‘under construction’ page.
After filling in the simple Form fields the simple Security question is presented : Is fire Hot or Cold?
When I enter text into the answer field it works successfully, except, of course on a mobile device. In order for it to work on a mobile device, I believe I need to present a choice, rather than entering text - correct?
So, I’m looking for a possible simple tweak on this code, so that it will work for a mobile device, please. I don’t really want to re-write all of it, and I know it’s not super-secure, but it will do for now.

Here’s the last part of the Form:

<div>
<p>Security Question:<br> Is Fire Hot Or Cold?:
<input type="text" name="ans"/></p><br>
<p><input class="btn btn-action" type='submit' value="Send message"></p>
</div>
</form

Here’s the php:

<?php
// create an empty error array to hold any error messages\
$error = array();
$mailto     = 'someone@somewhere.com';
$mailsubj   = "ContactForm Submission";
$mailhead   = "From:SomehereForm\n";
$mailbody   = "--- Contact form results ---\n";
foreach($_REQUEST as $key => $value)
{
if($key != 'PHPSESSID')
{
$mailbody .= $key.": ".$value."\n";
}
}
if(isset($_POST['ans']) && $_POST['ans']!='hot')
{
// add error to error array
$error[] = header('Location: ww.somesite.com/WrongAnswer.html');
exit;
}
// if no errors are set, continue
if(empty($error))
{
header('Location: ww.somesite.com/ThankYou.html');
exit;
}
?>

Any assistance will be appreciated.

what mobile device do you use that does not support text input?!

I imagine many if not most of your other form fields are text fields, so why would you assume you can’t use text fields for a Captcha?

Does the form work on mobile if you remove the Captcha part?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.