-1

I am trying echo value in input field if update is set, something like this in code belove.

<input type="text" class="form-control" name="InputTitle" id="InputTitle" placeholder="Enter title" <?php if (isset($_GET['update'])) { echo 'value="<?php echo $list['naslov'] ?>"' } ?> required>

I get some error but i can't figure it out? Is there some better way to do this?

Davor Miljkovic
  • 61
  • 3
  • 14
  • Parse error: syntax error, unexpected '$list' (T_VARIABLE), expecting ',' or ';' in C:\xampp\htdocs\WeCollect\insert.php on line 39 – Davor Miljkovic May 28 '15 at 11:49

2 Answers2

1

Try this

 <input type="text" class="form-control" name="InputTitle" id="InputTitle" placeholder="Enter title" value="<?php if (isset($_GET['update'])) { echo  $list['naslov'] }?>" required>
Manashvi Birla
  • 2,837
  • 3
  • 14
  • 28
-1

Missing ;.

No need of echo inside another echo - echo 'value="<?php echo $list['naslov'] ?>"'

Only echo 'value="' . $list['naslov'] .'"' will work.

Try with -

<input type="text" class="form-control" name="InputTitle" id="InputTitle" placeholder="Enter title" <?php if (isset($_GET['update'])) { echo 'value="' . $list[naslov] . '"'; } ?> required>
Sougata Bose
  • 31,517
  • 8
  • 49
  • 87