smokewon Posted September 14, 2008 Share Posted September 14, 2008 Hey there, I'm trying to create a system log that allows a certain user to store and retrieve(view) logs, basic project i think but im very new to PHP, theres a form within addLog.php(which i had to rename slightly to be able to upload it here), that doesnt require all fields to be completed except for the changes field which is, however theres two other field called "users affected" and "outage duration" that doesnt HAVE to be filled out by the user but if it is must only contain numbers, heres a sample from postLog.php that is supposed to test for that: //code sample from postLog.php $logUsrAff = intval($_POST['usrsAffected']); $logOutage = intval($_POST['outageDuration']); if(!is_numeric($logUsrAff)){ echo <<<ERR <form><p id="center">Users Affected field must be a numeric value</p></form> <form action="addLog.php"><input type="submit" value="Add new Log" id="submit"></form> <form action="index.php"><input type="submit" value="Summary Page" id="submit"></form> ERR; exit; } if(!is_numeric($logOutage)){ echo <<<ERR <form><p id="center">Users Affected field must be a numeric value</p></form> <form action="addLog.php"><input type="submit" value="Add new Log" id="submit"></form> <form action="index.php"><input type="submit" value="Summary Page" id="submit"></form> ERR; exit; } problem im finding is that only one of these if statements is being actually tested(the first one), so im pretty stumped to why this would not work any help, feedback, tips, critism, is much appreciated for this php newbie, thanks in advance ps. the viewLog.php page is not complete and is meant to be a drill down view of the mainPage.php file for each table row [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/124152-trouble-finding-out-if-var-is-numeric/ Share on other sites More sharing options...
JasonLewis Posted September 14, 2008 Share Posted September 14, 2008 Well if the first one is being checked and $logOutage is not a number then the script will stop, because you have exit; You can try adding: ini_set("error_reporting", "1"); error_reporting(E_ALL); To the top of your page. Link to comment https://forums.phpfreaks.com/topic/124152-trouble-finding-out-if-var-is-numeric/#findComment-640990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.