views:

115

answers:

1

how to show success message against each form field like we show error message for each field..when i write

<?if(form_error('username')) {
  //show error message
}
else
   // show success message
?>

it shows success message when the form is loaded without validating anything..

A: 

Pretty much the same way you would test to see if the form has already been submitted... (and don't use short tags)

<?php 
    if(form_error('username')) {
      //show error message
    } elseif (isset($_REQUEST['submit_button_value'])) {
       // show success message
    }
?>
calumbrodie
Ryan
you should still be able to give it a value <input type="image" src="/images/graphics/button1.gif" value="submit_button_value" /> although this will give its own set of problems in IE. You could also just use a submit button and style it using css background image
calumbrodie