I am trying to create the following condition
1) User visits page
2) User enters code
3) If the code is valid, the user enters a page corresponding to the code
4) If the code is not valid, the user fails
This is so that people can view certain PDFs for an apartment rentals company.
What I would like to do, is to create a form, with an input for the special code.
When the form is submitted, it will simply redirect to url.com/[[value of input]].php
I tried creating a PHP handler to do this, but when I try it out, I get a blank page. I have limited experience with PHP, so I might be off on a completely wrong path.
Thoughts greatly appreciated on this
Here’s my form
<form id="enter_code" name="enter_code" action="code_handler.php" method="post">
<label for="code">Enter Your Apartment Code</label>
<input id="code" name="code" size="30" type="text" />
<input class="button" name="commit" style="font-weight:normal" type="submit" value="Sign in" />
</form>
and here’s my code_handler.php
<?php
header( 'Location: http://www.opohills.com/guests/pdf/<?=htmlspecialchars($_POST['code'], ENT_COMPAT)?>.php' ) ;
?>
Why using php within php