farahZ Posted July 25, 2013 Share Posted July 25, 2013 (edited) hey therei dont know whats wrong with my code.. form not sent to the database when clicking "save"the first part of the code is about uploading a picture, url saved to $paththe second part is about sending the data of the form filled (student info) if(isset($_REQUEST['save'])) { if (($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; $path="pic/".date("ymdHis")."_". $_FILES["file"]["name"]; if(move_uploaded_file($_FILES["file"]["tmp_name"], $path) ) { echo "تمت اضافة الصورة"; } } } else { echo "لم تتم اضافة الصورة<br>"; } if($sql=$db->query("INSERT INTO `kafala`.`std_basic` ( `id` ,`fname` ,`sname` ,`lname` ,`mname` ,`std_num` ,`acc_family` ,`home_phone` ,`mobile_phone` ,`email` ,`std_type` ,`sex` ,`nas` ,`mazhab` ,`dob` ,`sec_lan` ,`pic`,`std_siblings`,`std_mo3arrif`) VALUES (NULL , '".es("fname")."', '".es("sname")."', '".es("lname")."', '".es("mname")."', '".es("std_num")."', '".es("acc_family")."', '".es("home_phone")."', '".es("mobile_phone")."', '".es("email")."', '".es("std_type")."', '".es("sex")."', '".es("nas")."', '".es("mazhab")."', '".es("dob")."','".es("sec_lan")."', '".$path."', '".es("std_siblings")."', '".es("std_mo3arrif")."', '".es("std_activity")."')")) { echo "تمت اضافة الطالب<br>"; if( $_POST['std_type']=="ابتدائي") header("Location: newstd_elementary.php"); else if( $_POST['std_type']=="متوسط") header("Location: newstd_middle.php"); else if( $_POST['std_type']=="ثانوي") header("Location: newstd_secondary.php"); else if( $_POST['std_type']=="جامعي") header("Location: newstd_university.php"); else if( $_POST['std_type']=="دراسات عليا") header("Location: newstd_highLevel.php"); } else { echo 'student not added'; } } Edited July 25, 2013 by farahZ Quote Link to comment Share on other sites More sharing options...
requinix Posted July 25, 2013 Share Posted July 25, 2013 (edited) Count your columns and your values. [edit] And next time use a title that actually describes your problem. "help help help" does not give anyone any incentive to help you. Edited July 25, 2013 by requinix Quote Link to comment Share on other sites More sharing options...
.josh Posted July 25, 2013 Share Posted July 25, 2013 It gives me incentive to delete things. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.