Dear All, Please check the below code and tell me whats the problem with it as I am receiving error message. if(isset($_POST['reg'])){ if($_POST['new']=="new forms"){ echo'<a href="formpack.zip">Download Form Pack</a><br>'; echo'<a href="index.html"> Back to Home </a>'; if($_POST['new']=="New Forms"){ echo'<a href="formpack.zip">Download Form Pack</a><br>'; echo'<a href="index.html"> Back to Home </a>'; } }else{ echo" We are sorry the code you entered is not correct"; } } Regards Sahir Farid
There isn't anything wrong, just make sure your posting the "new" field in your form. By the way, more readable format and simple code: if (isset($_POST['reg'])) { if (strtolower($_POST['new']) == "new forms") { echo '<a href="formpack.zip">Download Form Pack</a><br>'; echo '<a href="index.html"> Back to Home </a>'; } else { echo "We are sorry the code you entered is not correct"; } } PHP:
Actually I want my form to work with both entries "new forms" as well as "New Forms". It works with "new forms" but not with "New Forms".
The code that x319 should resolve this issue because he is converting the whole string to lower case. Have you tried using it?
Whats the difference between both codes, as both are same but first one is working and second one is not working properly i-e, executing both statements before and after "else" ##This one is working if(isset($_POST['reg'])){ if (strtolower($_POST['new'])=="new forms"){ echo'<a href="formpack.zip">Download Form Pack</a><br>'; echo'<a href="index.html"> Back to Home </a>'; } }else{ echo" We are sorry the code you entered is not correct"; } ##AND ##This one is showing error if(isset($_POST['addform'])){ if (strtolower($_POST['loc'])== "update forms"){ echo'<a href="Locationch.pdf">Download Location Form</a><br>'; echo'<a href="index.html"> Back to Home </a>'; }else{ echo" We are sorry the code you entered is not correct"; } }