PHP Prevent blank upload

PHP Prevent blank upload

In my small PHP application, i am posting a data to server using POST method in PHP, which is working fine. But the problem is that it also accepts blank data as well as duplicate value. Is there any way to check and prevent it from posting the blank value?

Thanks!

View Answers

March 23, 2011 at 12:11 PM

To prevent the PHP application from accepting blank data and duplicate values ..you need to validate it first. See the code below...

if(isset($_POST['submit']) && !empty($_POST) ){
  // now do with your post data
}









Related Tutorials/Questions & Answers:
PHP Prevent blank upload
PHP Prevent blank upload  In my small PHP application, i am posting a data to server using POST method in PHP, which is working fine. But the problem... to check and prevent it from posting the blank value? Thanks
upload video using php
upload video using php  How to upload a video on MYSQL Server using PHP Code..? Can any one provide me an example
Advertisements
Multiple File Upload in PHP
Multiple File Upload in PHP  Hi, I am beginner in PHP scripting language. I am very interested to learn PHP application. So, can anyone explain or provide related reference about how to Multiple file upload in PHP. Thanks
zip file upload in php - WebSevices
zip file upload in php  This is not a normal upload. we know the code for normal upload. i need the zip file upload code in php. how to upload zipfile using php? and how to unzip using php? please i dont
upload image in php
)upload.php: <?php if(isset($_POST['upload']) && $_FILES['userfile...upload image in php  after select image,how to save it in a folder...; <td width="80"><input name="upload" type="submit" class="box" id="upload
How to Increase Upload File Size Limit in php
Size Limit for php script   Sometimes you need to upload large files. But the default file upload size settings restrict you to upload large files. PHP... can also check it: http://www.phpzag.com/php-increase-upload-file-size-limit
upload value to php server in getmethod in j2me
upload value to php server in getmethod in j2me  Dear Team, I successfully capture image and decode that image, here i have one doubt after... method to php server in j2me can you give some tips for me... Thanks and Regards
PHP code for csv file upload into mysql
PHP code for csv file upload into mysql  I want to upload a file from my pc to mysql server using upload option. while i m selecting the csv file it ll be upload the mysql database. can u send me the coding? i have tried
problem to do coding upload image in php
problem to do coding upload image in php  can i get example coding how to upload image in php?i have try it but i dont no wheter it is correct...;/form> </body> </html> 2)upload.php: <?php if ((($_FILES
UItextfield blank
UItextfield blank  Hi, How I can check if UITextfield is blank and then display error to the user? ThanksADS_TO_REPLACE_1   Hi, Following code can be used to validate the user input in iPhone and iPad applications
prevent browser refresh
prevent browser refresh   prevent browser from refresh in Javascript
UPLOAD
UPLOAD  how to upload image using html
Struts2 blank application - Struts
Struts2 blank application  Hi I am new to struts2 and i am trying to run the strutsblank application by following the following Link; http://www.roseindia.net/struts/struts2/index.shtml As per the instructions given
How to design a blank CD, design a blank CD, blank CD
How to design a blank CD       This is a blank CD example, You will learn here how to make a blank CD by taking help of this example. New File: Take a new file with any
Running problem with NoughtsAndCrossesGame in blank
Running problem with NoughtsAndCrossesGame in blank  Hi i was having problem created NoughtsAndCrossesGame in end the it works but i runs the gui in blank. Its another way to solve it /* * To change this template, choose
php
php   what is php   PHP Tutorials
php
php  what is php
prevent mutli-click using struts tokens.
prevent mutli-click using struts tokens.  How to prevent mutli-click using struts tokens
php
php using javasript  how to set timer in php using javasript
uploading image in php - PHP
uploading image in php  I am looking for a PHP script to upload image into mysql database
php
php  i want to know about php and php plateform required software to make php program and database that used in php program?   Please visit the following link: PHP database
php
php  i want to know about php and php plateform required software to make php program and database that used in php program?   Please visit the following link: PHP database
php
php  show the constructor overloading in php
PHP
PHP  How to work in drupal with PHP
Validaton(Checking Blank space) - Spring
Validaton(Checking Blank space)  Hi i am using java springs .I am having problem in doing validation. I am just checking blank space. This is my controller. I named it salescontroller. package controller; import
upload pdf
upload pdf   i want to dispal content of pdf fil and stored into database in human readable form using php . how can i do
PHP
PHP   hii, Define PHP?   Hello,ADS_TO_REPLACE_1 The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used
php
php  what is php   PHP is one of the most used open source server-side scripting language, which runs on almost all the platform. PHP... and Solaris. To know more about PHP, Visit Here
php
php  how to write a program in php to create pdf file
php
php  plz tell me code for PHP SQL Insert,delete,update,view is used to insert the record from HTML page to Mysql database using in single PHP form
php
php  retrieve data from mysql in php   Please visit the following links: http://www.roseindia.net/sql/mysql-table/mysql-php-select.shtml http://www.roseindia.net/sql/mysql-example/select-where.shtml
php
php  How to catch a image and link click counters using Ajax php can any one help me
php
php  how to set email remainder in php?can you help me pls
PHP
PHP  I want to create Calendar Event in PHP. Could u help me
PHP
PHP  How to check whether a username exists on a website using php and cURL and not MySQL
MySQL Blank Field
MySQL Blank Field This example illustrates how to find Blank field by the MySQL Query. In the table 'example' two t_count fields are blank and we find both field which has some value by query 'select * from example where t_count
php
Write a simple PHP program that display the days of week as per the system date using switch case statement.  Write a simple PHP program that display the days of week as per the system date using switch case statement
PHP
PHP  I would love to do PHP project with the title of "Hospital Management System". I want to know how to make validation using jquery
How to prevent adding duplicate items to the shopping cart
How to prevent adding duplicate items to the shopping cart  ...;?php session_start(); if (!isset($_SESSION['SHOPPING_CART'])){ $_SESSION...: ' . $_SERVER['PHP_SELF']); } else if (isset($_GET['remove'])){ unset($_SESSION
php
can learn php mysql connectivity examples from the given link: PHP Mysql Connectivity
How to prevent the page refresh while submitting the form??
How to prevent the page refresh while submitting the form??  Hi. Requirement: There are two drop down boxes.Dropdown2 should load corresponding... every time when changing Dropdown1. Is there any way in JAVA SCRIPT to prevent
php
shortcut method in php like in javscript seletedIndex
php
php  im beginner to php. i faced problem with creating form and data stored into mysql <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <
php
php  im beginner to php. i faced problem with creating form and data stored into mysql <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <
Drop Down Reloads again in IE..How to prevent this?
Drop Down Reloads again in IE..How to prevent this?  Hi i was using two drop down box..One for Displaying date followed by another for Dispalying Month..If i Select/Change Month from the 2nd drop down then the 1st drop down
how can we prevent back option after log out.
how can we prevent back option after log out.  how can we prevent back option after log out
PHP
PHP PHP stands for Hypertext Preprocessor; PHP is server-side scripting language for development of web applications. PHP powerful and robust programming..., Roadsend PHP, Phalanger, Quercus, Project Zero and HipHop framework. PHP
blank space in input field - Java Beginners
blank space in input field  I retrieved the fields from my mysql table...If the field contains null value i want to display a blank space in input field(text box)..but i am displaying null how to overcome this.. u r help
how to prevent user selecting past date from calender
how to prevent user selecting past date from calender  how to prevent user selecting past date from calender ex: today's date is 21st march user should not select 20th march or below
image upload in webapp/upload folder
image upload in webapp/upload folder  sir i want to store upload image in my project directory WebApp/Upload_image/ pls send the jsp servlet code when i upload the image one error found "system cannot found the specified path

Ads