spick Posted October 31, 2008 Share Posted October 31, 2008 Hi, need a little help. I have a form that enters data into a mysql database. What I want is if the menu_name field is empty then it redirects back to the entry page and if it's not empty it redirects to a content page. I can't seem to get it to work, when I leave the field empty it stills enters the data to the database and redirects me to the content page. i follow the lynda.com tutorials and the video example worked but mine didn't for some reason. The codes are exactly the same except some variables. any help is appreciated. <?php $errors=array(); //form validation if(!isset($_POST['menu_name']) || empty($_POST['menu_name'])){ $errors[]='menu_name'; } if(!empty($errors)){ redirect("new_subject.php"); } ?> <?php $menu_name = mysql_prep($_POST['menu_name']); $position = mysql_prep($_POST['position']); $visible = mysql_prep($_POST['visible']); ?> Link to comment https://forums.phpfreaks.com/topic/130820-empty-function-help/ Share on other sites More sharing options...
kenrbnsn Posted October 31, 2008 Share Posted October 31, 2008 Please post the form that invokes this script. Ken Link to comment https://forums.phpfreaks.com/topic/130820-empty-function-help/#findComment-679060 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.