PHP echo different locations on a page -


i have made form outputs error messages if have not write in right stuff in right places.

i got 4 fields. username, last_name, first_name , email. when haven't written in right stuff in right field outputs error here:

if($validation->fails()) {     //here } else {     echo 'everything okay!'; } 

example:

  • that username taken.
  • the email not valid.

all of errors gets output in on place. don't want that. want the errors output under each field not in 1 place.

this error groups:

  1. echo '<div class="error_message">',($validation->errors()->all('username')), '</div>';
  2. echo '<div class="error_message">',($validation->errors()->all('last_name')), '</div>';
  3. echo '<div class="error_message">',($validation->errors()->all('first_name')), '</div>';
  4. echo '<div class="error_message">',($validation->errors()->all('email')), '</div>';

this code outputs errors in 1 place:

echo '<div class="error_message">', ($validation->errors()->all()), '</div>'; 

so question how output 4 error groups on 4 different places?

at place want display $error1, put:

if ($error1) {     echo $error1; } 

do same thing other errors , appropriate place.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -