Need help with PHP input form

Hello everyone i need help with a php form because i am quiet new with this, but i need a form that has a question(input) and in order for them to submit it they need to answer it correctly(match a specific phrase of characters)? I know how to have min characters and max characters but it needs to match exactly. Any help would be much appreciated.

Hi shutdown511. Welcome to the forums. :slight_smile:

In the code that processes a form, you generally should include some code that checks the data that has been entered. For example, you check that what’s entered in the email field really is an email and nothing else. You do this with “regular expressions”, which check the data against a certain pattern.

You can do the same in this case, although you could probably make it simpler by just insisting that the form submission is only accepted if $question === $confirmation, or something like that.

Perhaps show us some of your code so we can give more specific advice.

Thanks, this is a part of it. So i need someone to answer the anagram.(input) so its the exact phrase and only then can they submit and goto welcome.php. thanks!!

<script src=“validate.js” type=“text/javascript”></script>
</head>
<body>
<h3>Can Mend Our Souls “Eager adventurer stunner"Out In To The Waters
<form method=“post” action=“welcome.php” id=“user_registration” name=“user_registration”>
<p>
<label for=“user”>Anagram-</label><input type=“text” name=“user” maxlength=“26” id=“user” value=”"/>
</p>
<p>
<input type=“submit” name=“submit” id=“submit” value=“Enter”>
</p>
</form>
<script>
error_color = ‘#FEFE00’;
function validateuser_registration(formname) {
if (!minLength(formname.user,26,“That is not the phrase.”)) return false;else
if (!IsEmpty(formname.name,“You forgot to enter your name !”)) return false;else
if (!IsEmpty(formname.surname,“You forgot to enter your surname !”)) return false;else
if (!isEmail(formname.email,“You must enter a valid email !”)) return false;else
if (!minLength(formname.pass,6,“Your password must have at least 6 characters !”)) return false;else
if (!passwordMatch(formname.pass,formname.pass2,“Password don’t match !”)) return false;else
;
return true;};
function user_registrationinit(e)
{
if ( validateuser_registration(document.user_registration) == false )
{
if (!e) var e = window.event;
if (e.preventDefault) {
e.preventDefault();
e.stopPropagation();
} else {
e.returnValue = false;
e.cancelBubble = true;
}
return false;
} else
{
return true;
}
//cancel submit if validate returns false;
}

if (document.getElementById(‘user_registration’).addEventListener)
{
document.getElementById(‘user_registration’).addEventListener(‘submit’, user_registrationinit, false);
} else if (document.getElementById(‘user_registration’).attachEvent)
{
document.getElementById(‘user_registration’).attachEvent(‘onsubmit’, user_registrationinit);
} else
{
document.getElementById(‘user_registration’).onclick = user_registrationinit;
}</script>

You’ve only posted JS and HTML here, rather than PHP. What is in your welcome.php file?