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']'.

  1. you have single quotes within single quotes without them being escaped result in error
  2. 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

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -