Forum Moderators: coopster
However I'd like to alter it so the submit button could takes the user to one of a dozen or so pages dependant on what is entered.
So if the user entered timbuctu it would take them to
mysite.co.uk/timbuctu/
--------------------- PHP/HTML:
<?php
$password = "apassword";
if ($_POST['txtPassword']!= $password) {
?>
<h1>Login</h1>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<p><label for="txtpassword">Password:</label>
<br /><input type="password" title="Enter your password" name="txtPassword" /></p>
<p><input type="submit" name="Submit" value="Login" /></p>
</form>
<?php
}
else {
?>
<p>'private' content</p>
<?php
}
?>
------------------
Ideally the solution would not have to refer to a database - i.e all the data is.
Anyone know how I can go about this? (I'm a dimwit at best, when using PHP)
Cheers, Limbo.
you want to redirect the user to a url which is the same as the password entered?
Not exactly. We want the user to be directed to a folder that corresponds to printed flyers with differing url's we have mailed to households.
This page is generic to all visitors - the 'password' will then lead them to the next geotargeted section. So each different area cannot be visible to another when/if they are on the homepage. It's convoluted.
$txtPassword = strip_tags($_POST['txtPassword']); // and any more data scrubbing ...
switch ($txtPassword)
{
case 'timbuctu':
header('http://example.co.uk/timbuctu/');
break;
case 'timbucthree':
header('http://example.co.uk/timbucthree/');
break;
default:
// an unexpected entry was made
}