Note that there are some explanatory texts on larger screens.

plurals
  1. POcode works fine in localhost but not in server
    primarykey
    data
    text
    <p>I need to submit form to databse,my form and its php code for submission into database working correctlyn in localserver,but when i upload it in main server after submission an empty php file is shown,no error messages ,data also not entered into database, when i include the php code for uploaded image this problem arises else other details in form getting submitted successfully.....</p> <p>As a learner all kind of suggestion is appreciable....Thanks in advance</p> <pre><code> &lt;?php error_reporting(E_ALL); $name = $_POST['name']; $date = $_POST['year']."-". $_POST['month']."-".$_POST['date']; $date = mysql_real_escape_string($date); if (isset($_POST['gender'])){ $gender = $_POST['gender']; } if (isset($_POST['maritalstatus'])){ $maritalstatus = $_POST['maritalstatus']; } $registerby =$_POST['registerby']; $livingplace =$_POST['livingplace']; $qualification =$_POST['quali']; $occupation =$_POST['occupation']; $income = $_POST['income']; $contactno =$_POST['mobno']; $caste =$_POST['caste']; $email =$_POST['email']; if(isset($_POST['submit'])) { //Assign the paths needed to variables for use in the script $filePathFull = "/public_html/www.****.com/icons/".$_FILES["imagefile"] ["name"]; $filePathThumb = "/public_html/www.*****.com/icons/"; //Assign the files TMP name and TYPE to variable for use in the script $tmpName = $_FILES["imagefile"]["tmp_name"]; $imageType = $_FILES["imagefile"]["type"]; //Use a switch statement to check the extension of the file type. If file type is not valid echo an error switch ($imageType) { case $imageType == "image/gif": move_uploaded_file($tmpName,$filePathFull); break; case $imageType == "image/jpeg": move_uploaded_file($tmpName,$filePathFull); break; case $imageType == "image/pjpeg": move_uploaded_file($tmpName,$filePathFull); break; case $imageType == "image/png": move_uploaded_file($tmpName,$filePathFull); break; case $imageType == "image/x-png": move_uploaded_file($tmpName,$filePathFull); break; default: echo 'Wrong image type selected. Only JPG, PNG or GIF formats accepted!.'; } // Get information about the image list($srcWidth, $srcHeight, $type, $attr) = getimagesize($filePathFull); $origRatio = $srcWidth/$srcHeight; //Create the correct file type based on imagetype switch($type) { case IMAGETYPE_JPEG: $startImage = imagecreatefromjpeg($filePathFull); break; case IMAGETYPE_PNG: $startImage = imagecreatefrompng($filePathFull); break; case IMAGETYPE_GIF: $startImage = imagecreatefromgif($filePathFull); break; default: return false; } //Get the image to create thumbnail from $startImage; $width = 150; $height = 150; if ($width/$height &gt; $origRatio) { $width = $height*$origRatio; }else{ $height = $width/$origRatio; } //Create the thumbnail with true colours $thumbImage = imagecreatetruecolor($width, $height); //Generate the resized image image imagecopyresampled($thumbImage, $startImage, 0,0,0,0, $width, $height, $srcWidth, $srcHeight); //Generate a random number to append the filename. $ran = "thumb_".rand () ; $thumb2 = $ran.".jpg"; //global $thumb_Add_thumb; //Create the path to store the thumbnail in. $thumb_Add_thumb = $filePathThumb; $thumb_Add_thumb .= $thumb2; //Create the new image and put it into the thumbnails folder. imagejpeg($thumbImage, "" .$filePathThumb. "$thumb2"); } if(isset($_POST['submit'])) { $connection = mysql_connect("localhost","user", "pass"); if(! $connection) { die('Connection Failed: ' . mysql_error()) ;} mysql_select_db("database") or die (error.mysql_error()); $sql = "INSERT INTO quickregister(Name,Gender,Dateofbirth,Maritalstatus,Qualification,Income,Livingplace,Caste,Contactno,Emailaddress,Registerby,picture,filePathThumb,Occupation)VALUES('".$name."','".$gender."','".$date."','".$maritalstatus."','".$qualification."','".$income."','".$livingplace."','".$caste."','".$contactno."','".$email."','".$registerby."','".$filePathFull."','".$thumb_Add_thumb."','".$occupation."')"; $retval = mysql_query( $sql, $connection ); if(! $retval ) { die('Could not enter data' . mysql_error()); } echo "&lt;b&gt;Your data was added to database&lt;/b&gt;"; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload