html - My php script outputs a blank page -
i have php page accepts , processes form submission, page displays when requested, if page submitted , form validation fails, page suppose re-displayed form errors, on page re-display, php displays blank page when reaches error processing block. here code processes validation errors:
<?php if(isset($errorlog) , is_array($errorlog)): ?> <div class="alert alert-danger"> <?php $output = ''; if($errorlog['message'] == '') { $output = "<ul class='error-list'>"; foreach($errorlog $key => $value) { if ($key != 'has_error_occured') { $output .= "<li><strong>{html($key)}</strong> <span>{html($value)} </span></li>"; } } $output .= "</ul>"; } else { $msg = $errorlog['message']; $output .= "<p>{html($msg)}</p>"; } echo $output; ?> </div> <?php endif; ?>
and here code processes form submission
if(isset($_get['transfer']) or (isset($_post['action']) , $_post['action'] == transfer)){ $transfer_type = $_get['ttype']; if(isset($_post['action']) , $_post['action'] == transfer){ //process money transfer. $log = process_transfer(); if(isset($log) , is_array($log)){ if($log['has_error_occured']){ $_session['error_log'] = $log; //unset log unset($log); include_once $docroot . '/users/temp/tranfer.html.php'; exit(); }else{ $_session['transfer_msg'] = "your international transfer processed successfully"; header('location: ?summary'); } } //reload primary page. header('location: .'); }else{ include_once $docroot . '/users/temp/tranfer.html.php'; exit(); } }
note:
i have tried passing error array global variable can see in code snippet above.
i have tried passing in session.
i have tried using output buffering appending
ob_start()
@ beginning ,ob_end_flush()
@ end form script.i have added
error_reporting(-1); ini_set('display_errors', true);
@ start of form script know if page encounters error during processing, no avail.i using phpstorm xampp v3.2.1 development on windows 7.
please, cause of nightmare appreciated. thanks.
if wanna use $_get , $_post better use $_request, allows access both $_get , $_post
not transfer should "transfer"
if errorlog session data should be
if(isset($_session['errorlog']) , is_array($_session['errorlog'])):
i didn't find thing created name message
if($errorlog['message'] == '')
why u used it, think must 'has_error_occured'
Comments
Post a Comment