sirmika Posted October 28, 2008 Share Posted October 28, 2008 Hello all. I am new to php and I hope I am not bothering anyone with simple questions. I have simple field <INPUT TYPE="text" NAME="val1" SIZE="10"> and I want to add validation to it. I want to allow only numbers and only number that are higher or equal to 500 Can anyone help? Thanks Link to comment https://forums.phpfreaks.com/topic/130422-solved-validating/ Share on other sites More sharing options...
rhodesa Posted October 28, 2008 Share Posted October 28, 2008 are you looking to validate it Client Side (with JavaScript before the form submits) or Server Side (with PHP after the form submits) i'll assume Server Side since you posted in PHP... <?php if(empty($_POST['val1']) || !is_numseric($_POST['val1']) || $_POST['val1'] < 500){ die("Validation Failed"); } ?> Link to comment https://forums.phpfreaks.com/topic/130422-solved-validating/#findComment-676537 Share on other sites More sharing options...
sirmika Posted October 28, 2008 Author Share Posted October 28, 2008 That is it. Thanks a lot mate Link to comment https://forums.phpfreaks.com/topic/130422-solved-validating/#findComment-676813 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.