I am using a modal to add new data to a database using an html form which submits the data to a PHP script. Everything works great if there are no errors detected by my PHP script but if I find any errors, I want to reload the modal to show the error message.

The modal includes a span with a php command to display the error from the variable set up by my PHP script, like thgis:

<span class="pull-left has-error"> <?php echo $result['MessageText']; ?></span>

I have used this technique for a long time in non-modal pages and it works fine but I cannot find a way to force a redisplay of the modal so the error shows up.

Any ideas on how to do it?