PHP form

HI

I’m afraid that i am a PHP Novice at the moment so please bare with me. Below is the code that is part of my form block from my Concrete 5 site. I have wrapped the formblock in an accordion div that hides the form when not being used. What i would like to achieve is moving the ‘SUCCESS’ and ‘ERROR’ messages so that they display outside of the form block as the accordion collapses on page refresh.

I can move the error message outside of the form block without a problem by moving the div class error div to outside the form block, i think this works because of whats written below, however i would also like to achieve the same result with the ‘SUCCESS’ message but I am unsure what to do.

Any help would be greatly appreciated.

many thanks

[php]

//Collate all errors and put them into divs
$errorHeader = $formResponse;
$errors = is_array($errors) ? $errors : array();
if ($invalidIP) {
$errors[] = $invalidIP;
}
$errorDivs = ‘’;
foreach ($errors as $error) {
$errorDivs .= ‘

’.$error."
\n";
}

[/php]

Form Code


<div id="request-info-wrapper">
  <ul class="menu noaccordion">
		<li>
			<a href="#">Request Further Information</a>
            
			<ul class="acitem">
				<li>
<br/>
<div id="formblock<?php  echo $bID; ?>" class="formblock">
<form enctype="multipart/form-data" id="miniSurveyView<?php  echo $bID; ?>" class="miniSurveyView" method="post" action="<?php  echo $formAction ?>">

	<?php  if ($success): ?>
		
		<div class="success">
			<?php  echo $thanksMsg; ?>
		</div>
	
	<?php  elseif ($errors): ?>

		<div class="errors">
			<?php  echo $errorHeader; ?>
			<?php  echo $errorDivs; /* each error wrapped in <div class="error">...</div> */ ?>
		</div>

	<?php  endif; ?>


	<div class="fields">
		
		<?php  foreach ($questions as $question): ?>
			<div class="field field-<?php  echo $question['type']; ?>">
				<label <?php  echo $question['labelFor']; ?>>
					<?php  echo $question['question']; ?>
					<?php  if ($question['required']): ?>
						<span class="required">*</span>
					<?php  endif; ?>
				</label>
				
				<?php  echo $question['input']; ?>
			</div>
		<?php  endforeach; ?>
		
	</div><!-- .fields -->
	
	<?php  if ($captcha): ?>
		<div class="captcha">
			<label><?php  echo $translatedCaptchaLabel; ?></label>
			<br />
			<?php  $captcha->display(); ?>
			<br />
			<?php  $captcha->showInput(); ?>
		</div>
	<?php  endif; ?>

	<input type="submit" name="Submit" class="submit" value="<?php  echo $translatedSubmitLabel; ?>" />

	<input name="qsID" type="hidden" value="<?php  echo $qsID; ?>" />
	<input name="pURI" type="hidden" value="<?php  echo $pURI; ?>" />
	
</form>
</div><!-- .formblock -->
         </li>
				
			</ul>
		</li>
		
	</ul>
    </div>

move:
[php]

[/php]
to right above:
Sponsor our Newsletter | Privacy Policy | Terms of Service