I'm new to PHP and have come up against a brick wall with an if statement.
I have an activation form that users need to complete to activate a membership card. When activation is successful, their details are stored in a MYSQL DB.
At the moment, the field that they need to enter the unique membership card number in can accept any number so i need to change it so that only numbers within a certain range will be accepted. The range is 60006000 to 60011000. This is the code is have done myself:
if ($_POST < "60006000" or $_POST > "60011000") {
die('The TW number you have entered is not valid. Please click the back button and re-enter the number ensuring the TW prefix is removed.');
}
Needless to say, it doesn't work. It just takes me to the die message no matter what number i enter. This is obviously something to do with my IF statement being wrong so has anybody got any ideas on where i'm going wrong?
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I removed the $ from $TWnumberfoundonmembershipcard and it works fine now. The code now reads:
if ($_POST < "60006000" or $_POST > "60011000") {
die('The TW number you have entered is not valid. Please click the back button and re-enter the number ensuring the TW prefix is removed.');
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm new to PHP and have come up against a brick wall with an if statement.
I have an activation form that users need to complete to activate a membership card. When activation is successful, their details are stored in a MYSQL DB.
At the moment, the field that they need to enter the unique membership card number in can accept any number so i need to change it so that only numbers within a certain range will be accepted. The range is 60006000 to 60011000. This is the code is have done myself:
if ($_POST < "60006000" or $_POST > "60011000") {
die('The TW number you have entered is not valid. Please click the back button and re-enter the number ensuring the TW prefix is removed.');
}
Needless to say, it doesn't work. It just takes me to the die message no matter what number i enter. This is obviously something to do with my IF statement being wrong so has anybody got any ideas on where i'm going wrong?
Matt
Problem solved:
I removed the $ from $TWnumberfoundonmembershipcard and it works fine now. The code now reads:
if ($_POST < "60006000" or $_POST > "60011000") {
die('The TW number you have entered is not valid. Please click the back button and re-enter the number ensuring the TW prefix is removed.');
}