Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

non-database php form stuffs

$
0
0

Hello!

 

I am attempting to put together a little 'login' of sorts, where a user inputs 4 numeric values into a form. The values are then compared to variables in a php script to see if the input matches. If the input matches, the php script should redirect to a new page. Problem is, when I hit the 'submit' button, the script itself is brought up, rather than a redirect. I'm trying to keep the values in the php script hidden as well so the user can't just ctrl+u and see what the script looks like. Any suggestions?

 

Here is my form:

<!-- Input Form -->
<div>
	<form id="inputForm" name="inputForm" method="POST" action="code-login.php">
		<p>Grab some coffee:		
		<input type="text" name="input1" size="2" />
		<input type="text" name="input2" size="2" />
		<input type="text" name="input3" size="2" />
		<input type="text" name="input4" size="2" />
		<input type="submit" value="Crack the Code!" />
		</p>
	</form>
</div>

and here is the php script:

<?php

	$firstValue =  $_POST['input1'];
	$secondValue =  $_POST['input2'];
	$thirdValue =  $_POST['input3'];
	$fourthValue =  $_POST['input4'];

if ((($firstValue === '##') && ($secondValue === '##')) && (($thirdValue === '##') && ($fourthValue === '##'))) { 
	header('http://www.someotherpage.com/'); 
	exit(); }
else { echo "The code is incorrect."; }
?>

BTW, the ##'s in the if statement are strictly there as place holders. Actual numbers will take their place in the real script.

 

Thanks!


Viewing all articles
Browse latest Browse all 13200

Trending Articles