Paul Posted October 22, 2012 Share Posted October 22, 2012 Hi all, I have a form with an array for error messages. If there is a problem the error messages appear at the top of the page. I would like to place them halfway down the page. I'm using the following piece of code to display the errors: else { foreach ($registration_error_messages as $reg_error) { echo "$reg_error"; } } In order to do this would I need to assign the $reg_error to another array and then use printr to display this array wherever I want? Or is there a better way? Cheers Paul Link to comment Share on other sites More sharing options...
margaux Posted October 22, 2012 Share Posted October 22, 2012 You could echo them into a div with a class echo '<div class="error">' . $reg_error . '</div>'; and then in your stylesheet set some rules for the error class. 1 Link to comment Share on other sites More sharing options...
Paul Posted October 30, 2012 Author Share Posted October 30, 2012 Margaux, Thanks for the answer and sorry for the slow response, I got sidetracked for a while. Your suggestion worked great. I used CSS to absolute position the div whereever I wanted. The only slight change I made (for anyone who's interested) is that I wrapped the whole lot in a div, including the foreach bit, otherwise if there was more than 1 error they just sat on top of one another as opposed to a list. Cheers Paul 1 Link to comment Share on other sites More sharing options...
Recommended Posts