I currently have fields on my form which are set up as integers in phpmyadmin.

I want to be able to display error messages if any field has been left blank when save is clicked, but at the moment i keep getting column '......' cannot be null.

or maybe an error which says " are you sure these fields are supposed to be blank" yes or no
if yes save all blank fields with 0, if no it will go back to the form for them to re enter.

Or can you get it so it highlights the fields which are empty?

Do you mean like the following:

<?php
$error='';
if (isset($_POST) && !empty($_POST)) {
if ($_POST['name']=='') {
$error = 'Name cannot be empty.<br />';
}
if ($error=='') {
//insert into mysql
}
}
?>
<form method="POST" action="">
<?php echo $error; ?>
<input type="text" name="name" />
<input type="submit" value="Send" />
</form>

when i add this code in, i get an error on this line:

<?php
mysql_free_result($Asset);
?>

Parse error: parse error in C:\wamp\www\new.php on line 436

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.