David David - 4 months ago 11
PHP Question

Display an input field that has some data and variables and then use the variable to display input

Okay, So I think it has something to do with the way I have the quotation marks. If there is a specific way or format to make this work that would be great. The error that I get when I run it is this.

syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/content/04/12274504/html/input.php on line 46


function isMobile() {
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER["HTTP_USER_AGENT"]);





$number_of_items =
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17'>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20 </option>

else {
$number_of_items = "<div class = 'inp-field'>
<input olimit='<?php echo $p['itemlimit'] ?>' id='<?php echo $foodcat.'-'.$eachFood['inventorymasterId'] ?>' name='pickList[<?php echo $eachFood['inventorymasterId'] ?>.<?php echo $eachFood['letterId'] ?>.<?php echo $eachFood['foodName'] ?>.<?php echo $p['programCode'] ?>]' class='form-control add-qty' type='text'>


<!DOCTYPE html>
<a href="http://dthom.net/input.php" >mobile</a>

<?php echo $number_of_items ?>


Remove echo from here because you already echoing this thing in your code

$number_of_items = "<div class = 'inp-field'>
                           <input olimit='".$p['itemlimit']."' id='".$foodcat.'-'.$eachFood['inventorymasterId']." name='pickList[".$eachFood['inventorymasterId'] . $eachFood['letterId'] .$eachFood['foodName'] . $p['programCode'] ." class='form-control add-qty'  type='text'>