0

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?

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by morrisproject
-1

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>
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.