php - Hidden input isn't hidden in Laravel blade template -
i'm trying make hidden input , set value in blade template isn't hidden , visible on page. field
{{ form::hidden('price', '<?php echo $item['price'] * $item['quantity'];?>') }} i have tried without <?php ?> tags because read in {{ }} in blade templates read php..
{{ form::hidden('price', '$item['price'] * $item['quantity']') }} throw error
'syntax error, unexpected 'price' (t_string)'
your issue '$item['price'] * $item['quantity']'.
- you have single quotes within single quotes without them being escaped result in error
- php evaluate string instead of expression want. there no need wrap expression in quotes.
so in blade 4, want:
{{ form::hidden('price', $item['price'] * $item['quantity']) }} blade version 5 only
in blade 5, {!! !!} should used html code.
{!! form::hidden('price', $item['price'] * $item['quantity']) !!}
Comments
Post a Comment