i am having issue undefined variable
this is my controller '''
if (empty($input['emp_id'])) {
$empname = $input['emp_first_name'] . " " . $input['emp_last_name'];
return redirect()->action('EmployeeController@printQr', ['emp_code' => $input['emp_code'], 'empname' => $empname['empname']]);
} else {
return redirect()->route('employeeList');
}
'''
this is my print page
<!DOCTYPE html>
<html>
<body>
<br/><br/>
<img src=".png" style="width: 250px;"/>
<br/>
Employee Code:
<br/>
Employee Name:
<script>
var emp_code = @json($emp_code);
var empname = @json($empname);
var ttt = '<br><br>' +
'<img src="' + emp_code + '.png" style="width:250px;" />' +
'<br>Employee Code: ' + emp_code +
'<br>Employee Name: ' + empname;
var newWin = window.open('', 'Print-Window');
newWin.document.open();
newWin.document.write('<html><body>' + ttt + '</body></html>');
newWin.document.close();
newWin.focus();
setTimeout(function () {
newWin.print();
newWin.close();
}, 150);
setTimeout(function () {
window.location.href = '/employee/index';
}, 160);
</script>
</body>
</html>
This is the error I get: ' ErrorException (E_ERROR) Undefined variable: empname (View: /var/www/html/attendance_system/resources/views/employee/print.blade.php) Previous exceptions
Undefined variable: empname (0)
'
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2EWhYyu
via IFTTT
Aucun commentaire:
Enregistrer un commentaire