This is my edit page where i want to get data from database in input box
JavaScript
x
@php
$abs = explode(',' , $order->product);
$quantitys = explode(',' , $order->quantity);
foreach (array_combine( $quantitys, $abs) as $quantity => $ab) {
$val = $ab . " " . $quantity;
echo "<input type=text name=pro value=$val>";
echo $val;
echo '<br>';
}
@endphp
This is pic you understand well after see image at bottom of input box this is original value that has to come
Advertisement
Answer
Rewrite this:
JavaScript
echo "<input type=text name=pro value=$val>";
to this
JavaScript
// add double quotes to attribute values
echo '<input type="text" name="pro" value="'.$val.'">';