onsubmit javascript to reload page but does not dispplay success message in Php -
i try reload page on current page when submit form prevent multiple data insert in each refresh page. below code reload current page not display successful message after form submit successful. pleas me solve problem. html code form below:-
<form action="#" method="post" onsubmit="settimeout(function () { window.location.reload(); }, 10)"> <input type="hidden" name="actionform" value="test"/> status: <input name="status" type="text" class="form-control" id=""> <label>remarks</label> <textarea name="remark" class="form-control" rows="3" placeholder="enter ..."></textarea> <button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-times"></i> discard</button> <button type="submit" class="btn btn-primary pull-left"><i class="fa fa-"></i> submit</button> </form>
my php code below:-
<?php if($_post) { if($_post['actionform']=='test') { $data['status'] = $_post['status']; $data['remark'] = $_post['remark']; $insert->info($data); ?> <div class="alert alert-success alert-dismissable"> <i class="fa fa-check"></i> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> <b>success!</b> </div> <?php } } ?>
you need use if..endif style, if want print html in manner.
have : http://php.net/manual/en/control-structures.alternative-syntax.php
Comments
Post a Comment