Jump to content

Compare 4 text fields and return page if correct.


tmcdonnell

Recommended Posts

Hi,

 

So i have a form with 4 text inputs (input1,input2,input3,input4).

 

When the user puts in 4 correct words, they are redirected to another page.

 

The words can be checked either via a field in a database or a variable.

Any wrong word in any of the text fields returns the user back to the page.

 

In other words: When the user clicks submit, we need to make sure all of the words are correct.

If they are not correct, nothing should happen. The user will remain on the page until they enter the correct words.

 

If the words ARE correct, they are directed to a new page with an image.

 

 

I am not sure how to approach this, I tried using if and case, however I am not sure of the combination to make all 4 fields checked before an out is given (ie, the page redirect).

 

Any help is appreciated.

 

 

 

Really?

 

<?php
if (
	!isset($field_1)
		OR
	!isset($field_2)
		OR
	!isset($field_3)
		OR
	!isset($field_4)
)
{
// go back to your page
}

if ($field_1 != 'what it should')
{
// go back to your page
}

if ($field_2 != 'what it should')
{
// go back to your page
}

if ($field_3 != 'what it should')
{
// go back to your page
}

if ($field_4 != 'what it should')
{
// go back to your page
}

// go to the result page

?>

 

I must be missing something. It can't be as simple as I think it is.

I need to compare the fields.

 

if (

 

input1="yes";

input2="no";

input3="maybe";

input4="yes";

 

then header redirect "well done";

 

else

 

header "go back to text input page";

)

 

 

Something like that, except this don't work =)

 

 

 

 

 

 

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.