Jump to content

Recommended Posts

hey there
i 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 $path
the 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 by farahZ
Link to comment
https://forums.phpfreaks.com/topic/280497-help-help-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.