May I ask, how are we able to put echo inside a variable that is subjected to be echoed out?
This is the code.
I'm trying to put in the values=""
the $user['firstname']
and $user['lastname']
while($row = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC)){
$out .= "
<div class='form-group' > <!-- hidden-->
<label for='postedby' class='col-sm-3 control-label'>Posted By</label>
<div class='col-sm-9'>
<input type='text' class='form-control' id='postedby' name='postedby'
value='$user['firstname'] $user['lastname']' style='text-transform:uppercase;width:90%' >
</div></div>
";
}
echo $out;
?>
Is there a way to do this? Echo inside echo?
Try this.
$out = '';
while($row = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC)){
$out .= '<div class="form-group" > <!-- hidden-->
<label for="postedby" class="col-sm-3 control-label">Posted By</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="postedby" name="postedby"
value="'.$user['firstname'].' '.$user['lastname'].'" style="text-transform:uppercase;width:90%">
</div></div>';
}
echo $out;
you've to concat firstname and lastname.