0

I have a form and php processing to store text and image to server my problem is when I submit form and check values are stored as null even if I enter values in input box

php processing:

<?php

$db_username = 'sanoj';
$db_password = '123456';
$file1 = isset($_FILES['files']['name'][0]) ? $_FILES['files']['name'][0] : null;
$file2 = isset($_FILES['files']['name'][1]) ? $_FILES['files']['name'][1] : null;
$file3 = isset($_FILES['files']['name'][2]) ? $_FILES['files']['name'][2] : null;
$file4 = isset($_FILES['files']['name'][3]) ? $_FILES['files']['name'][3] : null;
$file5 = isset($_FILES['files']['name'][4]) ? $_FILES['files']['name'][4] : null;
$newname = md5(rand() * time());
if (isset($_FILES['files'])) {
    $uploadedFiles = array();
    foreach ($_FILES['files']['tmp_name'] as $key => $tmp_name) {
        $errors = array();
        $file_name = md5(uniqid("") . time());
        $file_size = $_FILES['files']['size'][$key];
        $file_tmp = $_FILES['files']['tmp_name'][$key];
        $file_type = $_FILES['files']['type'][$key];

        if ($file_type == "image/gif") {
            $sExt = ".gif";
        } elseif ($file_type == "image/jpeg" || $file_type == "image/pjpeg") {
            $sExt = ".jpg";
        } elseif ($file_type == "image/png" || $file_type == "image/x-png") {
            $sExt = ".png";
        }
        if (!in_array($sExt, array('.gif', '.jpg', '.png'))) {
            $errors[] = "Image types alowed are (.gif, .jpg, .png) only!";
        }
        if ($file_size > 2097152000) {
            $errors[] = 'File size must be less than 2 MB';
        }
        $desired_dir = "user_data/";
        if (empty($errors)) {
            if (is_dir($desired_dir) == false) {
                mkdir("$desired_dir", 0700);        // Create directory if it does not exist
            }
            if (move_uploaded_file($file_tmp, "$desired_dir/" . $file_name . $sExt)) {
                $uploadedFiles[$key] = array($file_name . $sExt, 1);
            } else {
                echo "Couldn't upload file " . $_FILES['files']['name'][$key];
                $uploadedFiles[$key] = array($_FILES['files']['name'][$key], 0);
            }
        } else {

        }
    }

    foreach ($uploadedFiles as $key => $row) {
        if (!empty($row[1])) {
            $codestr = '$file' . ($key + 1) . ' = $row[0];';
            eval($codestr);
        } else {
            $codestr = '$file' . ($key + 1) . ' = NULL;';
            eval($codestr);
        }
    }
}
$orig_directory = "user_data/";    //Full image folder
$thumb_directory = "thumb/";    //Thumbnail folder

/* Opening the thumbnail directory and looping through all the thumbs: */
$dir_handle = @opendir($orig_directory); //Open Full image dirrectory
if ($dir_handle > 1) { //Check to make sure the folder opened
    $allowed_types = array('jpg', 'jpeg', 'gif', 'png');
    $file_type = array();
    $ext = '';
    $title = '';
    $i = 0;

    while ($file_name = @readdir($dir_handle)) {
        /* Skipping the system files: */
        if ($file_name == '.' || $file_name == '..')
            continue;

        $file_type = explode('.', $file_name);    //This gets the file name of the images
        $ext = strtolower(array_pop($file_type));

        /* Using the file name (withouth the extension) as a image title: */
        $title = implode('.', $file_type);
        $title = htmlspecialchars($title);

        /* If the file extension is allowed: */
        if (in_array($ext, $allowed_types)) {

            /* If you would like to inpute images into a database, do your mysql query here */

            /* The code past here is the code at the start of the tutorial */
            /* Outputting each image: */

            $nw = 100;
            $nh = 100;
            $source = "$desired_dir{$file_name}";
            $stype = explode(".", $source);
            $stype = $stype[count($stype) - 1];
            $dest = "thumb/{$file_name}";

            $size = getimagesize($source);
            $w = $size[0];
            $h = $size[1];

            switch ($stype) {
                case 'gif':
                    $simg = imagecreatefromgif($source);
                    break;
                case 'jpg':
                    $simg = imagecreatefromjpeg($source);
                    break;
                case 'png':
                    $simg = imagecreatefrompng($source);
                    break;
            }

            $dimg = resizePreservingAspectRatio($simg, $nw, $nh);
            imagepng($dimg, $dest);
        }
    }

    /* Closing the directory */
    @closedir($dir_handle);
}

try {
#connection 
    $conn = new PDO('mysql:host=localhost;dbname=3ss', $db_username, $db_password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    $data = $conn->prepare('INSERT INTO mobile (mcat, mtype, mtitle, image1, image2, image3, image4, image5, description, mmodel, modelnumber, alsoinclude, mcondition, price, youare, mname, email, phone, ylocation, ystreet) VALUES (:mcat, :mtype, :mtitle, :image1, :image2, :image3, :image4, :image5, :description, :mmodel, :modelnumber, :alsoinclude, :mcondition, :price, :youare, :mname, :email, :phone, :ylocation, :ystreet)');
    $mcat = filter_input(INPUT_POST, 'mtype', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $mtype = filter_input(INPUT_POST, 'mtype', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $mtitle = filter_input(INPUT_POST, 'mtitle', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $description = filter_input(INPUT_POST, 'description', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $mmodel = filter_input(INPUT_POST, 'mmodel', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $modelnumber = filter_input(INPUT_POST, 'modelnumber', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $alsoinclude = filter_input(INPUT_POST, 'alsoinclude', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $mcondition = filter_input(INPUT_POST, 'mcondition', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $price = filter_input(INPUT_POST, 'price', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $youare = filter_input(INPUT_POST, 'youare', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $mname = filter_input(INPUT_POST, 'mname', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $phone = filter_input(INPUT_POST, 'phone', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $ylocation = filter_input(INPUT_POST, 'ylocation', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $ystreet = filter_input(INPUT_POST, 'ystreet', FILTER_SANITIZE_STRING, FILTER_FLAG_ENCODE_AMP);
    $data->execute(array(
        ':mcat' => $mcat,
        ':mtype' => $mtype,
        ':mtitle' => $mtitle,
        'image1' => $file1,
        'image2' => $file2,
        'image3' => $file3,
        'image4' => $file4,
        'image5' => $file5,
        ':description' => $description,
        ':mmodel' => $mmodel,
        ':modelnumber' => $modelnumber,
        ':alsoinclude' => $alsoinclude,
        ':mcondition' => $mcondition,
        ':price' => $price,
        ':youare' => $youare,
        ':mname' => $mname,
        ':email' => $email,
        ':phone' => $phone,
        ':ylocation' => $ylocation,
        ':ystreet' => $ystreet
            ));
#exception handiling
} catch (PDOException $e) {
    echo $e->getMessage();
}

function resizePreservingAspectRatio($img, $targetWidth, $targetHeight) {
    $srcWidth = imagesx($img);
    $srcHeight = imagesy($img);

    // Determine new width / height preserving aspect ratio
    $srcRatio = $srcWidth / $srcHeight;
    $targetRatio = $targetWidth / $targetHeight;
    if (($srcWidth <= $targetWidth) && ($srcHeight <= $targetHeight)) {
        $imgTargetWidth = $srcWidth;
        $imgTargetHeight = $srcHeight;
    } else if ($targetRatio > $srcRatio) {
        $imgTargetWidth = (int) ($targetHeight * $srcRatio);
        $imgTargetHeight = $targetHeight;
    } else {
        $imgTargetWidth = $targetWidth;
        $imgTargetHeight = (int) ($targetWidth / $srcRatio);
    }

    // Creating new image with desired size
    $targetImg = imagecreatetruecolor($targetWidth, $targetHeight);

    // Add transparency if your reduced image does not fit with the new size
    $targetTransparent = imagecolorallocate($targetImg, 255, 0, 255);
    imagefill($targetImg, 0, 0, $targetTransparent);
    imagecolortransparent($targetImg, $targetTransparent);

    // Copies image, centered to the new one (if it does not fit to it)
    imagecopyresampled($targetImg, $img, 0, 0, 0, 0, $targetWidth, $targetHeight, $srcWidth, $srcHeight);

    return $targetImg;
}

?>

form:

<form class="form-horizontal" method="post" action="process/mobile/mobileprocessing.php" enctype="multipart/form-data">
    <fieldset>

        <!-- Multiple Radios (inline) -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="type">Type Of Ad&nbsp;&nbsp;&#10002;</label>
            <div class="col-md-4"> 
                <label class="radio-inline" for="type-0">
                    <input type="hidden" value="mobile" name="mcat">
                    <input type="radio" name="mtype" id="type-0" value="sell" >
                    I Want To Sell
                </label> 
                <label class="radio-inline" for="type-1">
                    <input type="radio" name="mtype" id="type-1" value="buy" >
                    I Want To Buy
                </label>
            </div>
        </div><br>
        <div class="form-group">
            <label class="col-md-4 control-label" for="textinput">Title For Your Ad&nbsp;&nbsp;<r>*</r>&nbsp;&#10002;</label>  
            <div class="col-md-4">
                <input id="textinput" name="mtitle" type="text" placeholder="&#10002;&nbsp;&nbsp;1 Year Old Sony Xperia Neo v in Market Road at Rs.10000" class="form-control input-md">
                <span class="help-block">A title more than 60 characters have 2X more sell!.</span>
            </div>
        </div><br>

        <div id="uploa">
            <div class="dis1234 lift">
                <input type="file" name="files[]" multiple id="files" class="hidde fileInpu"/>
            </div>
            <output id="list"></output>
            <div class="dis1234 rite">
                <span>Don't Upload Internet Images</span>
            </div>
        </div><br>

        <div class="form-group">
            <label class="col-md-4 control-label" for="textarea">Description&nbsp;<r>*</r>&nbsp;&#10002;</label>
            <div class="col-md-4">                     
                <textarea class="form-control" id="textarea" name="description" placeholder="Description About Your Ad"></textarea>
            </div>
        </div><br>

        <!-- Select Multiple -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="selectbasic">Select Brand&nbsp;<r>*</r>&nbsp;&#10002;</label>
            <div class="col-md-4">
                <select id="dropone" name="mmodel" class="form-control">
                    <option>Select a Mobile Brand</option>                            
                    <option value="vodafone">Vodafone</option>
                    <option value="lg">LG</option>
                    <option value="o2">O2</option>
                    <option value="htc">HTC</option>
                    <option value="samsung">Samsung</option>
                    <option value="nokia">Nokia</option>
                    <option value="fly">FLY</option>
                    <option value="alcatel">Alcatel</option>
                    <option value="zen">Zen</option>
                    <option value="palm">Palm</option>
                    <option value="viva">Viva</option>
                    <option value="intex">Intex</option>
                    <option value="karbonn">Karbonn</option>
                    <option value="lava">Lava</option>
                    <option value="tataindicom">Tata Indicom</option>
                    <option value="rocker">Rocker</option>
                    <option value="lemon">Lemon</option>
                    <option value="wynncom">Wynncom</option>
                    <option value="virginmobile">Virgin Mobile</option>
                    <option value="gfive">G-Five</option>
                    <option value="geepee">Gee Pee</option>
                    <option value="inq">INQ</option>
                    <option value="iball">Iball</option>
                    <option value="airfone">AirFone</option>
                    <option value="acer">Acer</option>
                    <option value="byond">Byond</option>
                    <option value="beetel">Beetel</option>
                    <option value="sagem">Sagem</option>
                    <option value="toshiba">Toshiba</option>
                    <option value="benq">BenQ</option>
                    <option value="pantech">Pantech</option>
                    <option value="videocon">Videocon</option>
                    <option value="spice">Spice</option>
                    <option value="zte">ZTE</option>
                    <option value="blackberry">BlackBerry</option>
                    <option value="maxx">Maxx</option>
                    <option value="appleiphone">Apple iPhone</option>
                    <option value="micromax">Micromax</option>
                    <option value="sonyericsson">Sony Ericsson</option>
                    <option value="hp">HP</option>
                    <option value="motorola">Motorola</option>
                    <option value="dell">Dell</option>
                    <option value="imate">I-Mate</option>
                    <option value="other">Other</option>
                </select>
            </div>
        </div><br>
        <div class="form-group">
            <label class="col-md-4 control-label" for="textinput">Mobile Model&nbsp;<r>*</r>&nbsp;&#10002;</label>  
            <div class="col-md-4">
                <input id="textinput" name="modelnumber" type="text" placeholder="Xperia Neo v" class="form-control input-md">
            </div>
        </div><br>
        <div class="form-group">
            <label class="col-md-4 control-label" for="textinput">Also Includes&nbsp;&nbsp;&#10002;</label>  
            <div class="col-md-4">
                <input id="textinput" name="alsoinclude" type="text" placeholder="Case, Headset, Charger" class="form-control input-md">
            </div>
        </div><br>


        <!-- Multiple Radios (inline) -->
        <div class="form-group">
            <label class="col-md-4 control-label" for="radios">Condition&nbsp;<r>*</r>&nbsp;&#10002;</label>
            <div class="col-md-4"> 
                <label class="radio-inline" for="radios-0">
                    <input type="radio" name="mcondition" id="radios-0" value="new" >
                    New
                </label> 
                <label class="radio-inline" for="radios-1">
                    <input type="radio" name="mcondition" id="radios-1" value="old">
                    Old
                </label>
            </div>
        </div><br>

        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="textinput">Price&nbsp;&nbsp;&#10002;</label>  
            <div class="col-md-2">
                <input id="textinput" name="price" type="text" placeholder="&#8377;" class="form-control input-md">
            </div>
        </div>
        <hr>
        <h3>
            <center>Seller Information</center>    
        </h3>
        <hr>
        <div class="form-group">
            <label class="col-md-4 control-label" for="selectbasic">You Are&nbsp;<r>*</r>&nbsp;&#10002;</label>
            <div class="col-md-4">
                <select id="dropone" name="youare" class="form-control">
                    <option>Select Bellow</option>                            
                    <option value="Individual">Individual</option>
                    <option value="Dealer">Dealer</option>
                </select>
            </div>
        </div><br>
        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="textinput">Name&nbsp;<r>*</r>&nbsp;&#10002;</label>  
            <div class="col-md-4">
                <input id="textinput" name="mname" type="text" placeholder="Sanoj Lawrence" class="form-control input-md">
            </div>
        </div><br>

        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="textinput">Email&nbsp;<r>*</r>&nbsp;&#10002;</label>  
            <div class="col-md-4">
                <input id="textinput" name="email" type="text" placeholder="&#10002;Mail@mail.com" class="form-control input-md">
                <span class="help-block">Your mail id will not be shared</span>
            </div>
        </div><br>

        <!-- Text input-->
        <div class="form-group">
            <label class="col-md-4 control-label" for="textinput">Phone Number&nbsp;&nbsp;&#10002;</label>  
            <div class="col-md-4">
                <input id="textinput" name="phone" type="text" placeholder="&#9742;&nbsp;&nbsp;Phone Number" class="form-control input-md">
            </div>
        </div><br>
        <div class="form-group">
            <label class="col-md-4 control-label" for="textinput">Your Loaction&nbsp;&nbsp;&#10002;</label>  
            <div class="col-md-4">
                <input id="textinput" name="ylocation" type="text" placeholder="Enter Your Loacation (Town or Village Name)" class="form-control input-md">
            </div>
        </div><br>
        <div class="form-group">
            <label class="col-md-4 control-label" for="textinput">Your Street&nbsp;&nbsp;&#10002;</label>  
            <div class="col-md-4">
                <input id="textinput" name="ystreet" type="text" placeholder="Enter Your Street (Street or Area)" class="form-control input-md">
            </div>
        </div><br>
        <center>
        <input type="submit" class="btn btn-success"></center>
    </fieldset>
</form>

SQL:

create table `mobile`(
`id` int(9) NOT NULL auto_increment,
`mcat` varchar(255)  NULL default '',
`mtype` varchar(255)  NULL default '',
`mtitle` varchar(255)  NULL default '',
`image1` varchar(255)  NULL default '',
`image2` varchar(255) NULL default '',
`image3` varchar(255) NULL default '',
`image4` varchar(255) NULL default '',
`image5` varchar(255) NULL default '',
`description` varchar(255) NULL default '',
`mmodel` varchar(255) NULL default '',
`modelnumber` varchar(255) NULL default '',
`alsoinclude` varchar(255) NULL default '',
`mcondition` varchar(255) NULL default '',
`price` varchar(255) NULL default '',
`youare` varchar(255) NULL default '',
`mname` varchar(255) NULL default '',
`email` varchar(255) NULL default '',
`phone` varchar(255) NULL default '',
`ylocation` varchar(255) NULL default '',
`ystreet` varchar(255) NULL default '',
`ipnu` varchar(255) NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 ;
Turophile
  • 3,367
  • 1
  • 13
  • 21
  • i don't get any error –  Feb 26 '15 at 18:09
  • Why are you sanitizing prepared statement values? – Machavity Feb 26 '15 at 18:11
  • @Machavity even if i sanitizing inputs i will get text stored in SQL but its null `empty` –  Feb 26 '15 at 18:14
  • I suggest you start from the ground up and rebuild this with single entries. Once you've gotten success, you can keep on adding the building blocks, while making sure you've got the correct database/table chosen, column types/lengths are correct etc. etc. Once you've achieved that, the rest is gravy. Good luck. – Funk Forty Niner Feb 26 '15 at 20:39
  • @Fred-ii- i tried with single value its storing null only –  Feb 27 '15 at 15:11
  • Then it's the way you've got your table/column(s) setup. – Funk Forty Niner Feb 27 '15 at 15:12
  • then what should i do??? –  Feb 27 '15 at 15:18
  • @Fred-ii- if could help me to solve this problem it would be great because am stucked with this problem for past 3 day but this worked well a month back but now itsn't –  Feb 27 '15 at 15:22
  • @Fred-ii- if i run only with text text are stored but when i add image upload code it saves null any idea were to correct –  Feb 27 '15 at 15:58
  • What's your question – Steve Robbins Mar 04 '15 at 00:43
  • @SteveRobbins above code are correct and if i upload images more than 5mb in local host all values are stored null –  Mar 04 '15 at 08:35
  • @ohgodhelpme you should post output of `phpinfo()` – taco Mar 08 '15 at 22:25

4 Answers4

2

I copied your codes ( including the SQL ) tested it on my machine and with the exception of Thumbnail folder, which you did not remember to create, things worked fine. So to create this directory, I added the following after the definition:

if ( is_dir( $thumb_directory ) == false) {        
    mkdir("$thumb_directory", 0700);        // Create directory if it does not exist
}

I guess the problem is with the environment. First find out if your files are actually being submitted. Do this at the very top ( the exit() is to terminate the script after dumping the $_FILES array):

var_dump( $_FILES['files'] );
exit();

This will print array of uploaded files on the screen. If the files are properly submitted, you should see something like

array(5) { ["name"]=> array(5) { [0]=> string(23) "Computer ICE Africa.JPG" [1]=> string(24) "Computer ICE Africa2.jpg" [2]=> string(27) "Computer ICE AfricaLogo.png" [3]=> string(17) "Guest - SLAB4.jpg" [4]=> string(17) "Guest - SLAB5.jpg" } ["type"]=> array(5) { [0]=> string(10) "image/jpeg" [1]=> string(10) "image/jpeg" [2]=> string(9) "image/png" [3]=> string(10) "image/jpeg" [4]=> string(10) "image/jpeg" } ["tmp_name"]=> array(5) { [0]=> string(24) "C:\xampp\tmp\php3630.tmp" [1]=> string(24) "C:\xampp\tmp\php3641.tmp" [2]=> string(24) "C:\xampp\tmp\php3642.tmp" [3]=> string(24) "C:\xampp\tmp\php3643.tmp" [4]=> string(24) "C:\xampp\tmp\php3653.tmp" } ["error"]=> array(5) { [0]=> int(0) [1]=> int(0) [2]=> int(0) [3]=> int(0) [4]=> int(0) } ["size"]=> array(5) { [0]=> int(103834) [1]=> int(95387) [2]=> int(12901) [3]=> int(204380) [4]=> int(179149) } }

If you see the above ( file names and sizes will differ), then inspect the size array:

["size"]=> array(5) { [0]=> int(103834) [1]=> int(95387) [2]=> int(12901) [3]=> int(204380) [4]=> int(179149)

Make sure you upload files of a few kb each. The total of those will be less than 1 MB to start with. Try all this and let's see how it goes.

Stephen Adelakun
  • 784
  • 2
  • 7
  • 24
0

You should check the query errors.

I guess your problem is related to:

'image1' => $file1,
'image2' => $file2,
'image3' => $file3,
'image4' => $file4,
'image5' => $file5,

It should be:

':image1' => $file1,
':image2' => $file2,
':image3' => $file3,
':image4' => $file4,
':image5' => $file5,

Also, if you want to check the query's error:

Error Checking for PDO Prepared Statements

Community
  • 1
  • 1
Wissam El-Kik
  • 2,469
  • 1
  • 17
  • 21
  • You already implemented PDO Error Handling using "echo $e->getMessage();". If it doesn't print a message, then your problem has nothing to do with the query. Probably, the scripts fails before reaching the query. – Wissam El-Kik Mar 02 '15 at 13:28
  • i don't get error message any idea how to solve this –  Mar 02 '15 at 13:31
  • The problem isn't in the query. The script fails before reaching the query. You need to debug the code to check whether it enters the "if statements", the "loops" etc. – Wissam El-Kik Mar 02 '15 at 13:49
  • am confused about it can you please help me –  Mar 02 '15 at 14:03
  • i found problem since there are multiple images when total image size is more than 3mb values are stored NULL how can i correct that,,tried changing in `php.ini` but doesn't work –  Mar 02 '15 at 14:06
  • u probably mean that "when total image size is less than 3mb" – Wissam El-Kik Mar 02 '15 at 14:08
  • http://stackoverflow.com/questions/2184513/php-change-the-maximum-upload-file-size – Wissam El-Kik Mar 02 '15 at 14:09
  • when total size is less than 3MB values are stored if its more than 3mb values are null –  Mar 02 '15 at 14:10
  • and tried increasing maximum upload size changin in `php.ini` and in php file size>8mb –  Mar 02 '15 at 14:12
  • Yep. It shared the link to solve that. If you don't have access to the PHP.ini file, then write the following at the top of your PHP script: `ini_set('post_max_size', '64M'); ini_set('upload_max_filesize', '64M');` – Wissam El-Kik Mar 02 '15 at 14:12
  • doesn't works after adding `ini_set('post_max_size', '64M'); ini_set('upload_max_filesize', '64M');` same problem –  Mar 02 '15 at 14:20
  • [ini_set function][1] (only for PHP version below 5.3): and my version is 5.5.12 –  Mar 02 '15 at 14:24
  • Then use any of the other solutions mentioned in the link I gave you. – Wissam El-Kik Mar 02 '15 at 14:45
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/72071/discussion-between-wissam-el-kik-and-ohgodhelpme). – Wissam El-Kik Mar 02 '15 at 15:32
  • 1
    @WissamEl-Kik You cannot set post_max_size or upload_max_filesize with ini_set(), they must be set in php.ini, at the webserver level (httpd.conf), or in an .htaccess file. – Roger Halliburton Mar 06 '15 at 07:47
  • @RogerHalliburton I just looked it up. You're right, it won't work in PHP 5.3+. [Source 1](http://stackoverflow.com/questions/13442270/ini-setupload-max-filesize-200m-not-working-in-php/13442343#13442343) and [Source 2](http://php.net/manual/en/ini.list.php) – Wissam El-Kik Mar 06 '15 at 09:14
0

What about getting rid of the fourth parameter in filter_input() function?

Adrian Cid Almaguer
  • 7,815
  • 13
  • 41
  • 63
Marcel Djaman
  • 1,276
  • 1
  • 17
  • 34
  • is not a critique or clarification request! I suggested to remove the 4th argument in `filter_input($1st, $2nd, $3rd)` – Marcel Djaman Mar 06 '15 at 02:01
  • The way it's worded, it sounds like a comment/question. Maybe try to elaborate it or word it more like an answer or it'll get flagged as "not an answer". – Gary Mar 06 '15 at 03:36
0

Try to get rid of the NULL Default in your Data Base. Then, when you try to insert the values, it should give you the error.

Renato Reyes
  • 189
  • 1
  • 1
  • 10