Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preventing blank entries

Status
Not open for further replies.

tom11011

MIS
Joined
Oct 12, 2001
Messages
537
Location
US
How can I prevent a user from submitting a blank field in php or in the mysql database itself?

thanks.
 
if(empty($field)){
echo "fill me in";
}

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Hi, thanks for that, it works but continues down the script and adds the blank entry anyways. After it figures out it's blank, how do I prevent it from adding the blank entry into the database?
 
well, after you figure out you have blanks

if(empty($field)){
$blanks++;
}

if ($blanks > 0 ){

// dont run the query, maybe submit the data back to the form and get it corrected

}else{

// do update as there areno blanks

}

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
hey thanks for that, it worked.

:)
 
:-) glad to have helped

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top