Johnny2 Posted February 21, 2013 Report Posted February 21, 2013 I'm just trying to get a default value to show up in a form field (type=file) using the example below. Anyone know what I'm missing? I know the variable $imagefile is being populated correctly because I've tested it. Is it just something I'm missing in the html input tag at the bottom? // above in the php script: if (isset($_GET['id'])) { $targetID = $_GET['id']; $sql = mysql_query("SELECT * FROM products WHERE id='$targetID' LIMIT 1"); } while($row = mysql_fetch_array($sql)){ $imagefile = 'images_folder/' . $targetID . '.jpg'; } <!-- below in an html form: --> <input type="file" name="fileField" id="fileField" value="<?php echo $imagefile; ?>"/> Quote
falkencreative Posted February 22, 2013 Report Posted February 22, 2013 Unfortunately, it's not possible to set a default value on file fields. See http://bytes.com/topic/php/answers/906666-how-set-default-value-input-type-file-field-html, http://stackoverflow.com/questions/2665058/set-default-value-for-a-input-file-form and similar. Quote
Johnny2 Posted February 22, 2013 Author Report Posted February 22, 2013 Oh. Well then, I'll stop trying. Hahaha. Thanks Ben!!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.