lyndsey.pearce@ntlworld.com Posted April 12, 2006 Share Posted April 12, 2006 Hello!I have a simple HTML form with some PHP inside it:[code]<p>Upload new image: <input type="file" name="image_filename" id="image_filename" value="<?php echo $row['ImagePath']; ?>" /></p>[/code]All I want to do is display the contents of the field called "ImagePath" which is the path to an image stored on the server.The user can then click the browse button to change the path if they wish.I have no errors returned, but the path to the image is not displayed in the input field in the browser. I have done this for other input fields with a "type" of "text" and it works.Can anyone tell me what I am doing wrong?Cheers! Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 12, 2006 Share Posted April 12, 2006 Does "$row['ImagePath']" contain anything at the time the HTML is rendered?Can you post more of your code that leads up to this statement?Ken Quote Link to comment Share on other sites More sharing options...
lyndsey.pearce@ntlworld.com Posted April 12, 2006 Author Share Posted April 12, 2006 Hiya! I have checked field names and everything is correct.This is some more code here:[code] <?php If (isset ($_SESSION['AdminAccess'])) { $admin_username = $_SESSION['AdminUsername']; include ('common_db.php'); $link_id = db_connect(); //-----------------------PULL UP PAGE DETAILS----------------------------------------- $selectquery = "SELECT * FROM table WHERE FieldIDNumber = '" . $_GET['id'] . "'"; $result = mysql_query($selectquery) or die("Invalid query: " . mysql_error()); $row = mysql_fetch_array($result) ?><p>Last updated:<em><?php echo $row['FieldLastUpdate']; ?></em></p><form action="edit.php" method ="post" enctype="multipart/form-data"><p>Alter name: <input type="text" name="Name" size="25" value=" <?php echo $row['Name']; ?>" /></p><p>Alter heading: <input type="text" name="Heading" size="25" value=" <?php echo $row['Heading']; ?>" /></p><p>Alter Entry: <textarea name="Body" cols="50" rows="50"><?php echo $row['Body']; ?></textarea></p><p>Upload new image: <input type="file" name="image_filename" id="image_filename" value="<?php echo $row['PageImage']; ?>"/></p><p>Alter image title: <input type="text" name="ImageTitle" value="<?php echo $row['ImageTitle']; ?>" /></p><p>Alter image alt text: <input type="text" name="AltText" value="<?php echo $row['ImageAltText']; ?>" /></p><p><input type="submit" value="submit" /></form><?php}else { echo "<p>**You are not authorised to access this page!**</p>"; echo "<p><a href=\"AdminLogin.html\">login</a></p>"; }?>[/code]What is interesting is when I view the page source for the output I get this:[code]<h2>Edit details</h2><form action="edit.php" method ="post" enctype="multipart/form-data"><p>Alter name: <input type="text" name="Name" size="25" value=" Sitemap" /></p><p>Alter heading: <input type="text" name="Heading" size="25" value=" this is the heading" /></p><p>Alter body: <textarea name="Body" cols="50" rows="50">jf fjhjhuy uy u yu </textarea></p><p>Upload new image: <input type="file" name="image_filename" id="image_filename" value="/uploadimages/image.gif"/></p><p>Alter image title: <input type="text" name="ImageTitle" value="image is the title" /></p><p>Alter image alt text: <input type="text" name="AltText" value="image is the alt text" /></p><p><input type="submit" value="submit" /></form>[/code]The value seems to be pulled out, but the path is not displayed in the browser.Weird! Quote Link to comment Share on other sites More sharing options...
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.